假设您要添加重复的行完全按照链接的提问/回答描述...
当我使电网编辑我没有得到这个错误:真。您将需要提供一个代码示例,显示您的设置和错误。
现在,我已经说出了,我已经采取了相关的答案,并从它做出了一个Dojo,使网格可编辑,并成功地编辑了重复的行。
http://dojo.telerik.com/@Stephen/EHeFU
的微小变化必须作出让编辑为没有他们正常工作,编辑重复的DataItem也会使更改原始DataItem的,因为它们具有相同的标识,除非你做些什么它,即:
$("#duplicate").on("click", function() {
var items = [];
$(":checked", grid.tbody).each(function(idx, elem) {
var row = $(elem).closest("tr");
// Must duplicate the raw data only using toJSON(), otherwise the duplicated item will have the same identifier(uid) as the original.
var item = grid.dataItem(row).toJSON();
items.push(item);
});
for (var i = 0; i < items.length; i++) {
// You must also clear the model's id field otherwise the copy may not be treated as a new item.
items[i].ProductID = 0;
grid.dataSource.add(items[i]);
}
});
@Stephen:谢谢!显然我错过了上面提到的JSON部分的“必须”部分。奇迹般有效! –