Kendo UI网格:每60秒用新数据刷新网格数据:dataSource和observe() [英] Kendo UI grid: refreshing grid data every 60 seconds with new data: dataSource and observe()

查看:353
本文介绍了Kendo UI网格:每60秒用新数据刷新网格数据:dataSource和observe()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



编辑:以下是数据源如何分配给的数据初始配置:

  parsedData = $ .parseJSON(data); 

var dataSource = new kendo.data.DataSource({
data:parsedData
});
$ b $(#grid)。kendoGrid({
dataSource:dataSource,
...。

网格的dataSource能否一次性重新分配?或者单独删除dataSource.data中的项目,或清除数组,然后注入新项目还是全部替换数组?在Kendo数据源中观察模式的实现是否表明一种方法优于另一种?



我还没有着手这方面的工作,但是根据我对网格的经验,回到Visual Basic的早期阶段,改变网格的数据源一直有不良的副作用,我没有理由期望这样会更顺畅。希望我错了。 / p>

另一个编辑#(2013年4月26日):如果有一种方法用一组与之前结构相同的新行来刷新网格的底层数据,一种可以保持展开/折叠状态的方法网格的分组,这将非常适合我们的目的。

我们正在使用Kendo 2012.3.1315.340版本和我们这样工作:

  $(#YourGridNameHere)。data(kendoGrid)。dataSource。读(); 

就像您要将数据源再次读取数据一样。我们通常在requestEnd事件处理函数中执行它。



我希望这有助于某个人。


I want to refresh the Kendo UI grid's contents every 60 seconds with up-to-the-minute data.

EDIT: Here's how the dataSource is being assigned at initial configuration:

parsedData = $.parseJSON(data);

var dataSource = new kendo.data.DataSource({
    data: parsedData
});

$("#grid").kendoGrid({
    dataSource: dataSource, 
    . . .

Can the grid's dataSource simply be reassigned in one fell swoop? Or would it be better to remove the items in the dataSource.data individually, or by clearing the array, and then injecting new items or replacing the array in its entirety? Does the implementation of observe pattern in the Kendo dataSource indicate one approach over another?

I haven't embarked on this yet, but in my experience with grids, going way back to the early days of Visual Basic, changing a grid's datasource has always had undesirable side-effects and I have no reason to expect this will be any smoother sailing. Hope I'm wrong.

ANOTHER EDIT# (26 April 2013): if there is an approach to refreshing the grid's underlying data with a new set of rows having the same structure as previously, an approach that would preserve the expanded/collapsed state of the grid's groupings, that would be ideally suited to our purposes.

解决方案

We are using Kendo 2012.3.1315.340 version and for us it works this way:

$("#YourGridNameHere").data("kendoGrid").dataSource.read();

Like that you are telling the datasource to read data once more. We usually do it on the requestEnd event handler.

I hope this helps some one.

这篇关于Kendo UI网格:每60秒用新数据刷新网格数据:dataSource和observe()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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