如何检查 Kendo Grid 是否对其进行了更改? [英] How do I check if a Kendo Grid has had changes made to it?

查看:22
本文介绍了如何检查 Kendo Grid 是否对其进行了更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查 Kendo Grid 是否有变化?我听说有一个dirty 属性,但我找不到.

How can I check if a Kendo Grid has changes? I heard that there is a dirty property, but I cant find it.

推荐答案

添加的行会将脏属性设置为 true,更新的行也会如此.但是,删除的行存储在其他地方(在 _destroyed 集合中).将此函数传递给您网格的数据源以查看它是否有变化.

Added rows will have the dirty property set to true and so will updated rows. But, deleted rows are stored elsewhere (in the _destroyed collection). Pass this function the datasource of your grid to see if it has changes.

function doesDataSourceHaveChanges(ds)
{
    var dirty = false;

    $.each(ds._data, function ()
    {
        if (this.dirty == true)
        {
            dirty = true;
        }
    });

    if (ds._destroyed.length > 0) dirty = true;

    return dirty;
}

这篇关于如何检查 Kendo Grid 是否对其进行了更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆