Extjs 4.2 grid refresh loads old data -
i have grid in extjs 4.2, store configured below.
var userstore = ext.create('ext.data.jsonstore', { model: 'user', proxy: { type: 'ajax', api: { create: '/pwbench/form/products/fctrmgmt/data.json', read: '/pwbench/form/products/fctrmgmt/data.json', update: '/pwbench/form/products/fctrmgmt/data.json', destroy: '/pwbench/form/products/fctrmgmt/data.json' }, reader: { type: 'json' }, writer: { type: 'json' } }, autoload: true });
inside grid, on clicking save have following configured.
handler: function() { var recordsarray = new array(); var datarecords = new array(); recordsarray = grid.getstore().data.items; (var = 0; < recordsarray.length; i++) { console.log(recordsarray[i].data); datarecords.push(ext.encode(recordsarray[i].data)); } console.log(datarecords.length); ext.ajax.request({ url: 'mainpage.jsp', params: { records: datarecords }, success: function(response){ var text = response.responsetext; console.log(text); userstore.sync(); userstore.load(); } }); }
i have java class able read data sent ajax request , overwrite data.json file store uses fetch data. json file overwritten without issue, problem when call userstore.load() after sync, displays old data, prior making changes. on refreshing grid or refreshing whole page displays old data, when refresh entire project in eclipse , reload page, displays new overwritten data.
is cache problem? can please tell me issue?
you should put load in success callback of sync
userstore.sync({ success: function() { userstore.load...
Comments
Post a Comment