当服务调用选择新数据时,kendo angular 2 grid cusomized数据绑定问题将不会绑定

问题描述 投票:0回答:1

https://www.telerik.com/kendo-angular-ui/components/grid/columns/#toc-auto-generated-columns

Here Dynamically columns binding is missing:

The First time data binding correctly. The second time onwards it's not binding why?

this.gridData ---> is the Api response data

 this.gridView = {enter code here
          data: this.gridData,
          total: this.petService.pets.length
        };
asp.net-web-api kendo-grid kendo-ui-angular2
1个回答
0
投票

“第二次以后”是什么意思? Grid应该如何更新?

如果每次新数据到达时都会更新Grid绑定的对象,则将使用最新数据相应地重新呈现Grid,例如:

ngOnInit() {
      this.interval = setInterval(() => {
        const rnd = Math.floor(Math.random()*sampleCustomers.length);
        this.gridData = sampleCustomers.slice(rnd, rnd + 10)
      }, 1000);
    }

EXAMPLE

© www.soinside.com 2019 - 2024. All rights reserved.