使用ajax响应json - Ext.getCmp('theID').getStore() .getStore().reload() -不工作的重新加载groupingStore。

时间:2022-03-03 01:08:04

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.

你好,我有一个ext.GridPanel和一个GroupingStore。此面板用于显示搜索结果。当页面加载时,它是空的-正确的。当用户输入搜索条件并返回有效的json时,面板应该重新加载。我测试了所有的东西,直到重载为止——什么都不做。有什么想法呢?我已经坐了一段时间了。

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

2 个解决方案

#1


2  

ok managed to sort it out. See the solution below for anyone else facing similar situation:

好吧,好吧。对于其他面临类似情况的人,请参见下面的解决方案:

replace

取代

 Ext.getCmp('srchGrid').getStore().reload();

with

 Ext.getCmp('srchGrid').getStore().loadData(Ext.grid.dummyData);

easy peezy :)

容易peezy:)

njoy!

njoy !

#2


0  

Easier way

更简单的方法

sstore.reload();

sstore.reload();

#1


2  

ok managed to sort it out. See the solution below for anyone else facing similar situation:

好吧,好吧。对于其他面临类似情况的人,请参见下面的解决方案:

replace

取代

 Ext.getCmp('srchGrid').getStore().reload();

with

 Ext.getCmp('srchGrid').getStore().loadData(Ext.grid.dummyData);

easy peezy :)

容易peezy:)

njoy!

njoy !

#2


0  

Easier way

更简单的方法

sstore.reload();

sstore.reload();