PDA

View Full Version : Help needed for EXTJS GRID REFRESH DATA - using Ext.data.PagingMemoryProxy



baven
4 Oct 2011, 7:40 AM
This is the method to refresh the grid data after getting the response from the server.. but it is not refreshing the grid with the new data eventhough the alert(..) msg prints the new data... I need some help here. It always shows the new data first time, but after that it is always showing the older ones eventhough server returns the new data.

fileDataStore.load({params:{start:0, limit:50}}); is not refreshing the grid

fileDataStore.load(); //refreshes the grid, but the first page shows record range as 1-300 eventhough we have 50 per page setup in the datastore-reader config.

I use Ext.data.PagingMemoryProxy here. Is there any other Proxy to use for this?


fileUploadForm.getForm().submit({
url: readURL,
timeout : 600000,
params: {properFileName:pfileName},
waitMsg: 'Parsing and validating the file..this may take few minutes..',
success: function(form, action) {
obj = Ext.util.JSON.decode(action.response.responseText);
alert("creating new proxy for data "+Ext.util.JSON.encode(obj));
fileDataStore.proxy = new Ext.data.PagingMemoryProxy(obj);
fileDataStore.load({params:{start:0, limit:50}});
grid.getView().refresh(); },
failure: function(form, action) {
fileDataStore.removeAll();
}
});

//DATASTORE

var fileDataStore = new Ext.ux.data.PagingStore( {
reader : new Ext.data.JsonReader( {
id: 'myId',
root:'dtoList',
totalProperty:'totalCount',
successProperty : 'success',
messageProperty : 'message',
fields:[
{name: 'field1'},
{name: 'field2'},
.....
],
params : {
start : 0,
limit : 50
}
}),
listeners : {
'load': function(thisStore, records, options) {
........
.......
}
}
});


grid = new Ext.extend(Ext.grid.GridPanel,{
store: fileDataStore,
.....

baven
4 Oct 2011, 9:47 AM
I just added these :

fileDataStore.proxy = new Ext.data.PagingMemoryProxy(obj);
fileDataStore.load();
fileDataStore.reload({params:{start:0, limit:50}});

and it worked fine.