0

I assign the grid a dataSource at configuration time:

parsedData = $.parseJSON(data);
 var dataSource = new kendo.data.DataSource({
        data: parsedData
    });



$("#grid").kendoGrid({
        dataSource: dataSource,
        etc etc
        .
        .
        .

Then I bind to the change event post-configuration/initialization:

    var grid = $('#grid').data('kendoGrid');
    grid.dataSource.bind("change", function (e) {
        dataChanged();
    });

function dataChanged() {
    var grid = $("#grid").data("kendoGrid");
    grid.refresh();
}

Then I remove all of the items in the data array of the dataSource:

 while (grid.dataSource.data().length > 0) {
    grid.dataSource.data().pop();
}

The rows in the grid disappear, as anticipated. But then, with the empty grid, I drag a column header to the group panel, the grid repopulates itself.

I am trying to find a way to refresh the grid's data every 60 seconds, so it's important for me to know how to clear the data and replace it with different data, without having vestigial data somewhere that isn't tuned in to the observed array of observed objects.

Or maybe I am doing something wrong or incompletely -- very possible, since I'm just beginning to work with Kendo UI.

4

1 に答える 1

0

他の質問で言ったように、データ ソースのデータメソッドを使用する必要があります。

于 2012-12-16T09:24:03.677 に答える