Kendo Grid:当行更改时如何从代码更新数据源 [英] Kendo Grid: how to update data source from code when the row changes

查看:134
本文介绍了Kendo Grid:当行更改时如何从代码更新数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我以前的几篇文章的后续内容,内容涉及更新kendo网格数据源.我要做的最后一件事是在用户转到新行时发生这种情况(到目前为止,感谢@Lars提供了令人印象深刻的帮助)

this follows on from a few of my previous posts, regarding updating the kendo grid datasource. The last thing I want to do is have this occur when the user goes to a new row (thanks to @Lars so far for much impressive help)

我这样做是通过检测行更改(恰好在指令中执行此操作),并回调到我在数据源上调用sych函数的grids控制器中实现的.

I am doing this by detecting a row change ( happen to be doing this in a directive), and calling back into the grids controller where I call the sych function on the data source...

  vm.rowChangedCallback = function () {
    console.log("calling vm.gridData.sync");

    // Calling this exits edit mode and we go back to cell (0, 0) :-(
    vm.gridData.sync();
}

完整示例此处.例如,我们可以在第一行中进行制表,从下拉列表中选择一个新值,然后继续进行制表,当我们到达第二行时,将调用进行保存的回调.唯一的问题是网格退出编辑模式并返回到单元格(0,0).

Full example here. For example we may tab through the first row, select a new value from the drop down, and then keep tabbing, and when we reach the second row, the callback is called that does the saving. The only problem is the grid exits edit mode and goes back to cell (0, 0).

是否可以在不中断编辑会话的情况下进行数据源同步?呼叫是否需要异步(以某种方式)或类似的东西?

Is a way to do the data source syncing without interrupting the edit session? Does the call need to be async (somehow) or something like that?

任何帮助将不胜感激!

推荐答案

这是Kendo网格的一个已知问题,它无法进行部分刷新,它始终会重建整个表.有关如何处理该问题的信息,请参见此处.

This is a known problem with Kendo's grid, it can't do a partial refresh, it always rebuilds the full table. See my answer here on how you might deal with that.

这篇关于Kendo Grid:当行更改时如何从代码更新数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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