Reputation: 236
I am showing a grid in a loop. Each time in the loop I am setting the datasource to a new table which is represented in an array but the grid doesn't change. The columns from the previous table are shown and the new table columns are never shown. The crazy thing is the data is updated ONLY if the columns on table1 also exist in table 2 or 3.
How can I get the grid to update the once the datasource is changed?
ChangeGrid(file){
this.fileData = file;
}
<kendo-grid [kendoGridBinding]=fileData [height]='200' [pageSize]="10" [pageable]="true" [sortable]="true" [filterable]="false" [groupable]="false">
</kendo-grid>
Upvotes: 0
Views: 7462
Reputation: 841
You are basically replacing your variable which has the reference of KendoGridBinding
and you are replacing it with your new array, so binding is removed from your variable and is replaced by your array.
To show the changes sophisticatedly, you have to write your custom binding directive, follow the steps: http://www.telerik.com/kendo-angular-ui/components/grid/data-operations/data-binding/automatic-operations/
The shortcut: You can push or pop the array items, it will retain the binding which is present in your variable
ChangeGrid(file){
this.fileData.push(file[0]);
}
Upvotes: 1