KendoUI Angular 2 如何刷新Kendo Grid

KendoUI Angular 2 how to refresh Kendo Grid

我正在循环显示网格。每次在循环中我都将数据源设置为一个新的 table ,它在一个数组中表示但网格没有改变。显示先前 table 中的列,而不会显示新的 table 列。疯狂的是,仅当 table1 上的列也存在于 table 2 或 3 中时才会更新数据。

如何让网格在数据源更改后更新?

ChangeGrid(file){
this.fileData = file;
} 

  <kendo-grid [kendoGridBinding]=fileData [height]='200' [pageSize]="10" [pageable]="true" [sortable]="true" [filterable]="false" [groupable]="false">
        </kendo-grid>

您基本上是在替换具有 KendoGridBinding 引用的变量,并将其替换为您的新数组,因此绑定将从您的变量中删除并由您的数组替换。

要复杂地显示更改,您必须按照以下步骤编写自定义绑定指令:http://www.telerik.com/kendo-angular-ui/components/grid/data-operations/data-binding/automatic-operations/

快捷方式:您可以压入或弹出数组项,它将保留变量中存在的绑定

ChangeGrid(file){
this.fileData.push(file[0]);
}