简体   繁体   English

如何检测Kendo Grid angular2的数据绑定结束?

[英]How to detect end of data binding of Kendo Grid angular2?

We have an angular2 webapp where we are using Kendo Grid to display data.我们有一个 angular2 webapp,我们使用 Kendo Grid 来显示数据。 We retrieve the data from a restful webservice using JSDO.我们使用 JSDO 从一个安静的网络服务中检索数据。 We need to be able to detect when the rows have been rendered.我们需要能够检测到行何时被渲染。 The reason being that we need to select the first row by default and display some extra data in fields outside the grid.原因是我们需要默认选择第一行并在网格外的字段中显示一些额外的数据。

The Original Kendo Grid had the dataBound event that we could subscribe to.原始 Kendo Grid 具有我们可以订阅的 dataBound 事件。 We have not been able to find an equivalent in Angular2 grid.我们无法在 Angular2 网格中找到等价物。

Given that you bind to the Grid using [(ngModel)]="mydata" , the "databound" event is the moment you update mydata .鉴于您使用[(ngModel)]="mydata"绑定到网格,“databound”事件是您更新mydata的时刻。

Let's say you subscribe to an Observable which gives you the result of your webservice.假设您订阅了一个 Observable,它为您提供网络服务的结果。

You'll do something like that:你会做这样的事情:

    myObservable.subscribe(
        val => {
            this.mydata = val;
            // Do whatever you need to do here
        },
        error => {
            console.log(error);
        },
        () => {
        }
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM