PDA

View Full Version : How to refresh changes in store?



chenzhaoplus
6 Apr 2012, 6:08 PM
Hey guys!
I have a problem.
The data is showed in gridpanel,but when i update the store,it can not refresh.
My code:


Ext.Ajax.request({
url : 'http://localhost:8080/admin-web/jsonservice/foodEmbranchmentService.json',
method : 'POST',
jsonData : {
jsonrpc : "2.0",
id : 10,
method : "update",
params : [updateRec]
},
success : function(result, request) {
gridPanel.getView().refresh();
},
failure : function(form, action) {


}
});


By the way,if i add a record into store,it can refresh in gridpanel.
My code:


Ext.Ajax.request({
url : 'http://localhost:8080/admin-web/jsonservice/foodEmbranchmentService.json',
method : 'POST',
jsonData : {
jsonrpc : "2.0",
id : 10,
method : "create",
params : [addRec]
},
success : function(result, request) {
gridStore.add(addRec);
gridPanel.getView().refresh();
},
failure : function(form, action) {


}
});

icebergdelphi
6 Apr 2012, 6:14 PM
Hi, did you try in your store? :


autoSync: true,//Sincronizacion con el Servidor
autoSave: true, //<--- hace las peticiones al servidor automáticamente


You'd try to move to the MVC enviroment to develop your apps, you gonna write less code. greetings.

rushi2440
6 Apr 2012, 8:44 PM
@chenzhaoplus

success : function(result, request) {
gridStore.add(addRec);
gridPanel.getView().refresh();
},


please change with below

success : function(result, request) {
gridStore.add(addRec);
gridStore.sync();
},


Yogendra Singh
Sr. Programmer
Kintudesigns.com