【问题标题】:kendo angular 2 grid cusomized data binding issue when service call picks new data will not binding当服务调用选择新数据时,kendo angular 2 grid 自定义数据绑定问题不会绑定
【发布时间】:2017-12-19 14:11:50
【问题描述】:

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】:

    “第二个开始”是什么意思? Grid 究竟应该如何更新?

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

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

    EXAMPLE

    【讨论】:

    • 您好先生..!这对我不起作用。可能是我的解释是错误的。我在拉取请求时需要什么,数据将与动态标头和数据绑定。在第二个请求中,第一个请求数据不匹配的列数据将被绑定,除了这个不起作用。
    • 如果可能请帮助我。我处理它正在工作的角度材料,并使用它正在工作的 html 表格动态地进入 kenod angular 2 ui 网格。
    • 我想我理解这个问题。一旦从数据中动态推断出列结构,就无法进一步修改。我可以建议通过 *ngFor 提供列并根据传入的数据动态创建新的列结构,例如:
    猜你喜欢
    • 2014-04-20
    • 2017-03-16
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 2015-10-20
    • 2017-03-17
    • 2017-01-20
    • 2013-10-16
    相关资源
    最近更新 更多