本文介绍了如何重置OnDemandGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中将JSONrest存储与OnDemandGrid一起使用。第一次,网格加载良好,如果再次搜索其他数据,网格中已有的数据将与新数据重叠。有人可以告诉我如何重置或刷新OnDemandGrid?

I am using OnDemandGrid with JSONrest store in my application.For the first time,the grid is loading fine , if i search again for other data,the data already in the Grid is getting overlapped with new data.Can someone tell me how to reset or refresh the OnDemandGrid?

这是我的代码,

           function (request, Memory, OnDemandGrid,JsonRest) {

            var jsonstore = new JsonRest({target: url,idProperty: "srno"});
            grid = new OnDemandGrid({
                store: jsonstore,
                columns: Layout,
                minRowsPerPage : 40,
                maxRowsPerPage : 40,
                keepScrollPosition : true,
                loadingMessage: "Loading data...",
                noDataMessage: "No results found."
            }, "grid");
            grid.startup();

});

推荐答案

集合数据应设置为null;否则refresh()无法正常工作。另外,不应为收集数据分配空白存储对象 dojo.data.ItemFileReadStore

Collection data should be set to null; else refresh() wont work. Also collection data should not be assigned blank store object dojo.data.ItemFileReadStore.

grid.collection.setData("");
grid.refresh();

由于我们正在从OnDemandGrid删除集合,因此内部dstore错误将在控制台中记录以下js文件。

Since we are removing collection from OnDemandGrid internal dstore errors will be logged in console for below js files.

dstore/Trackable.js,
dstore/Memory.js,
dstore/Promised.js

这篇关于如何重置OnDemandGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:37