Jquery 如何在剑道UI网格的onDataBound事件中检查现有行值是否已更改?

Jquery 如何在剑道UI网格的onDataBound事件中检查现有行值是否已更改?,jquery,kendo-ui,kendo-grid,kendo-asp.net-mvc,Jquery,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我正在Asp.NETMVC中使用剑道UI网格 我在documentready函数中调用了下面的事件 function RefreshGrid() { setInterval(function () { $("#MediaBatchGrid").data("kendoGrid").dataSource.read(); $(".k-loading-image").hide(); }, 5000); } 只要在向

我正在Asp.NETMVC中使用剑道UI网格

我在documentready函数中调用了下面的事件

function RefreshGrid() {
        setInterval(function () {
            $("#MediaBatchGrid").data("kendoGrid").dataSource.read();
            $(".k-loading-image").hide();
        }, 5000);
    }
只要在向服务器发出请求时调用上述函数。整个数据将绑定在剑道网格UI中。所以,问题是,网格在闪烁,甚至保留网格中的现有值。 我关心的是,如何在客户端阻止这种闪烁?
如果新数据与现有值不同,那么只有在数据绑定时才会发生事件,这太棒了,否则返回&不需要在网格中进行任何UI更改

我为此挣扎了一段时间,最后,我找到了简单的解决方案

我们应该为HTML中的数据绑定定义一个事件。i、 e

 .Events(x => x.DataBinding("Grid_DataBinding"))
Jquery代码:

Grid_DataBinding = function (e) {



    var displayedData = $("#Grid").data().kendoGrid.dataSource.view();// this is to get Existing values from Grid

    var displayedDataAsJSON = JSON.stringify(displayedData);
// then convert it as JSON
    var newData = e.sender._data;// to get new data coming from Server

    var newDataAsJSON = JSON.stringify(newData);// convert it too as JSON

    if (newDataAsJSON === displayedDataAsJSON) {// Equal check

        e.preventDefault();// if both are equal, just prevent data binding event
        $(".k-loading-mask").hide();// this is to avoid grid flickering, hiding loader too


    }


}