剑道网格取消编辑嵌套的数据源 [英] kendo grid cancel edit on nested datasource

查看:146
本文介绍了剑道网格取消编辑嵌套的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的

  [{person_id} :1,person_name:John,
联系人:[
{email:john@domain.com}
]
}]

$ p



我将videmodel绑定到具有联系人详细信息模板的网格:

$ p> + person
=>联系1
=>联系人2

使用自定义弹出编辑器模板可以编辑网格,我可以在其中编辑人员和联系人形成。可用的个人联系人使用列表视图以及其上方的表单呈现(点击行绑定字段)。



我的问题在于取消编辑。由于联系人网格细节listview绑定到数据子集,因此它不会自动同步到编辑之前的状态。我不想重新同步整个网格,只需强制该联系人详细信息列表视图重新绑定即可。



是否有任何智能方法可以使详细列表视图察觉到数据更改?我在detailInit创建并绑定了详细的listview。也许用listview在某处存储记录id并在grid cancel事件中重新绑定它?



由于数据存储是嵌套的,因此只有最高级别才能正确响应更新和取消操作。嵌套(列表视图)级别至少有两种方式:(1)当您编辑顶层和嵌套的项目并更新时,网格将刷新,但详细列表视图不会(2)当您编辑顶层和嵌套层级并更新时,则再次打开编辑并简单地取消,当编辑器再次打开时,嵌套级别不会持久 - 数据将回滚到其原始状态(?)。所有这些都意味着存储嵌套级别的默认情况下没有被正确处理,并且需要一些更智能的方法,这是我缺乏知识或想法的。 解决方案

发现由于缺少记录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屋!

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