剑道网格取消编辑嵌套的数据源 [英] kendo grid cancel edit on nested datasource
问题描述
发现由于缺少记录ID而导致编辑不当。一旦我提供了唯一的ID,我就会得到预期的结果。
I have viewmodel with nested json datasource.
Here is my DEMO (use second contact "personal contact" for testing)
[{ person_id:1, person_name:"John",
contact: [
{email:"john@domain.com"}
]
}]
I am binding videmodel to grid with contacts detail template:
+ person
=> contact 1
=> contact 2
Grid is editable using custom popup editor template, where I can edit person and contacts all in one form. Available personal contacts are presented using listview with form above it (click on the row binds fields).
My problem lies with canceling edit. Because contacts grid detail listview is binded to a data subset, it is not automatically synced to a before edit state. I don't want to resync whole grid, just force that contact detail listview to rebind.
Is there any "smart" way to make detail listview aware of a data change? I am creating and binding detail listview at detailInit. Maybe store record id somewhere with listview and rebind it on grid cancel event?
Because data store is nested only top level responds correctly to the update and cancel actions. Nested (listview) levels doesn't in at least two ways: (1) when you edit top and nested item and update, grid will refresh, but detail listview will not (2) when you edit top and nested level and update, then open edit again and simply cancel, nested level is not persisted when editor is again opened - data is rolled back to its original state (?). All this points to store nested level not being handled correctly "by default" and some smarter way around is required which I lack knowledge or ideas.
Found out that editing misbehaved due to missing "record id". Once I provided unique id I am getting expected results.
这篇关于剑道网格取消编辑嵌套的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!