使用ajax响应json重新加载groupingStore - Ext.getCmp('theID').getStore().reload() - 不起作用
你好 所以我有一个带有 GroupingStore 的 ext.GridPanel。该面板用于显示搜索结果。当页面加载时它是空的 - 正确。当用户输入搜索条件并返回有效的 json 时,面板应重新加载。我测试了一切,一切都有效,直到重新加载位 - 这没有任何作用。有什么想法吗?我已经坐了有一段时间了。
谢谢大家!
//global var defined....
Ext.grid.dummyData = [];
//this within Ext.onReady(function() {
var sstore = new Ext.data.GroupingStore({
reader: sreader,
autoLoad: false,
data: Ext.grid.dummyData,
sortInfo: { field: 'company', direction: "ASC" },
groupField: 'scheme'
});
var sgrid = new sg.GridPanel({
id:'srchGrid',
store: sstore,
...
function searchNowBtn(id, txt, win) {
Ext.Ajax.request({
url: 'action.aspx',
params: "...",
success: function(r) {
Ext.grid.dummyData = [['dummy1', '', '', '', ''],['dummy2', '', '', '', '']];
Ext.getCmp('srchGrid').getStore().reload();
}
});
};
Hello
So i have an ext.GridPanel with a GroupingStore. This panel is meant to display search results. When the page loads it is empty - correct. The panel should reload when the user enters search criteria and returns with valid json. I tested everything and it all works until the reload bit - which doesnt do anything. Any ideas out there? I've been sitting with this for a while.
Thanks all!
//global var defined....
Ext.grid.dummyData = [];
//this within Ext.onReady(function() {
var sstore = new Ext.data.GroupingStore({
reader: sreader,
autoLoad: false,
data: Ext.grid.dummyData,
sortInfo: { field: 'company', direction: "ASC" },
groupField: 'scheme'
});
var sgrid = new sg.GridPanel({
id:'srchGrid',
store: sstore,
...
function searchNowBtn(id, txt, win) {
Ext.Ajax.request({
url: 'action.aspx',
params: "...",
success: function(r) {
Ext.grid.dummyData = [['dummy1', '', '', '', ''],['dummy2', '', '', '', '']];
Ext.getCmp('srchGrid').getStore().reload();
}
});
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更简单的方法
sstore.reload();
Easier way
sstore.reload();
好的,设法解决了。对于其他面临类似情况的人,请参阅下面的解决方案:
替换
为
easy peezy :)
高兴!
ok managed to sort it out. See the solution below for anyone else facing similar situation:
replace
with
easy peezy :)
njoy!