我正在尝试将增强型网格与 Dojo JSONREST 结合使用,但遇到了一些问题。
我一直在查找一些示例,但无法弄清楚如何做我需要的。
在下面的代码中,我的 rest 服务采用两个参数,并且对服务的查询有效。
问题是当 grid.startup() 被调用时,它似乎再次调用了 Rest 服务,因为没有传递参数,rest 服务失败了。我在这里做错了什么?
还有什么方法可以更新到商店,以便只包含查询的结果?,这样当网格出现时它只包含这些值?
感谢任何帮助或指示..
ready(function(){
var grid;
var store = new JsonRest({
target: "rest/search"
});
store.query({term: "test", category: "category"},
{
start: 10,
count: 10,
}).then(function(data){
// how do i update store with queried results?
});
dataStore = new ObjectStore({ objectStore: store });
/*set up layout*/
var layout = [[
{'name': 'Name', 'field': 'col1', noresize: true, 'width': '100%'},
]];
/*create a new grid:*/
grid = new EnhancedGrid({
id: 'grid',
store: dataStore,
structure: layout,
selectable: true,
selector: false,
selectionMode: 'none',
escapeHTMLInData: false,
autoHeight:true
}, document.createElement('div'));
grid.startup();
}
最佳答案
您是否尝试过设置网格的查询参数? A link to the docs . And a link to an example.
通过查看问题中的代码,似乎网格应该显示数据块/页面 - an example using the pagination plugin for the grid .
The filter plugin您可能也感兴趣。
关于带有 JSONREST 问题的 Dojo 增强型网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20077938/