我有一个批处理的网格。我通过jQuery修改数据,并将更改的值标记为这样的肮脏: grid._modelchange({field:" propertyName",model:dataitem});另一种方式是set()方法:dataitem.set(" propertyName"," value"),但我不使用它,因为非常慢。
我想连续将多个单元格标记为肮脏,但是当我标记第二个字段时,第一个道具的肮脏标记消失了,当将第三个字段标记为更改时,第二个字段的肮脏标记消失了,因此,只有第三个道具才变脏。
以下循环进行Dataitem更新并将字段标记为脏:
$(GridDataItems).each(function () {
this.Prop1 = false;
Grid._modelChange({ field: "Prop1", model: this });
this.Prop2 = "someValue";
Grid._modelChange({ field: "Prop2", model: this });
this.Prop3= "someOtherValue";
Grid._modelChange({ field: "Prop3", model: this });
}
);
我需要这样的东西:
Grid._modelChange({ field: "Prop1", model: dataItem },
{ field: "Prop2", model: dataItem },
{ field: "Prop3", model: dataItem });
对不消失的肮脏标记的任何想法?谢谢。
我相信这是剑道网格的正确行为。检查此链接:
http://www.telerik.com/forums/manaly-updating-multiple-values-values#yfubqgvy6uepysckirk08a
检查文章,这是关于用肮脏标志突出显示多个单元格:
http://blog.codebeastie.com/kendo-grid-javascript-data-manipulation/
谢谢大家,我终于在此博客文章中找到了解决方案:
https://web.archive.org/web/2017122713534/http://blog.code.code.codebeastie.com/kendo-gendo-grid-javascript-data-manipulation/
问题在于,如果我打电话给_modelcahnge for a属性,它会刷新整个行,并删除所有肮脏的单元格。
我将更改的属性名称存储在数组中,并在调用所有_modelChange()方法后,在数组上的循环中迭代,然后在该行中通过列名搜索我在Dataitem的UID中搜索的内容。