Grid Name : awesome-grid
Column Resizing Technique:
To capture the column resize event, we can utilize the columnResized property in the grid configuration.
<ag-grid-angular
class="ag-theme-alpine ag-grid-container-full"
[rowData]="rowData"
[columnDefs]="columnDefs"
(gridReady)="onGridReady($event)"
(columnResized)="onColumnResize($event)" // <-----
>
In the associated TypeScript file:
Since the resize event may be triggered multiple times, a debounce effect is implemented using setTimeout to handle it effectively.
public setTimeInstance = null;
onColumnResize(event) {
if (this.setTimeInstance) clearTimeout(this.setTimeInstance);
this.setTimeInstance = setTimeout(() => {
let newColumnState = this.columnApi.getColumnState();
this.someActivity(); // Perform some activity such as storage
clearTimeout(this.setTimeInstance);
}, 1000); // after one second
}