PDA

View Full Version : grid refresh data



genius551v
13 Apr 2011, 3:26 PM
Hey guys, i need a little help here.

i have a grid, is population with Json.

the first time i send a variable "meta" = 1, my PHP server decide if "meta" is 1 return a json array with columns configuration (something like a autogrid), that is ok.

but the second time, i send "meta" = 0, just to refresh the data NO the columns, my PHP server return the json array just with data:


{'data':[{'idStatement':'1','nameStatement':'Activo','infoStatement':''}],'totalCount':'1','success':true}

and that is ok too!

the problem is: my grid not refresh the rows data

this is my code:

MyGridPanel = function(config){
Ext.apply(this, config);

var ds = new Ext.data.Store({
fields: [],
autoLoad: true,
remoteSort: true,
autoDestroy: true,
baseParams: config.params,
reader: new Ext.data.JsonReader(),
proxy: new Ext.data.HttpProxy({url: config.url, method: 'POST'})
});

MyGridPanel.superclass.constructor.call(this,{
closable: true,
columns: [],
layout: 'fit',
loadMask: true,
bufferResize: 0,
store: ds,
columnLines: true,
trackMouseOver: true,
selModel: new Ext.grid.RowSelectionModel(),
viewConfig: {
onDataChange: function(){
if(this.ds.reader.jsonData.metaData){
this.cm.setConfig(this.ds.reader.jsonData.columns);
}
}
},
tbar: actionToolbar,
bbar: new Ext.PagingToolbar({
store: ds,
pageSize: 50,
displayInfo: true
})
});
};

my refresh modification is this:

Ext.override(Ext.PagingToolbar, {

doRefresh : function(){
this.store.setBaseParam('meta', 0);
this.doLoad(this.cursor);
}
});

tnks in advance for your help