Hi Manolo,
Greetings from Syncfusion support.
Query: grid with dynamic columns fire databound event in bucle
We have checked your query and we are able to reproduce the reported problem at our end with the provided sample. The grid.refreshColumns method is called repeatedly which is the cause of the issue. You can resolve the reported problem by using boolean variable like below. Refer below code snippets and sample for your reference.
[code example]
...
export class AppComponent {
public data: Object[] = [];
@ViewChild('grid', { static: true }) public grid: GridComponent;
public initial: boolean = true;
ngOnInit(): void {
this.data = [
{ OrderID: 1, CustomerID: 'VINET', Freight: 32.3800, OrderDate: '1996-07-02T00:00:00.000Z', City: 'Paris', Price: 300 },
...
];
}
dataBound(args: any) {
if (this.initial) {
for (const cols of this.grid.columns) {
...
}
this.grid.refreshColumns();
this.initial = false;
}
}
} |
Please get back to us if you need further assistance.
Regards,
Thavasianand S.