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

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

问题描述

这是我之前关于更新剑道网格数据源的一些帖子的后续内容.我想做的最后一件事是在用户转到新行时发生这种情况(感谢@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 函数...

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();
}

完整示例此处.例如,我们可以通过 Tab 键浏览第一行,从下拉列表中选择一个新值,然后继续 Tab 键,当我们到达第二行时,调用回调进行保存.唯一的问题是网格退出编辑模式并返回到单元格 (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天全站免登陆