I have a grid in Extjs 4.2, the store for it is configured as 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 the grid, on clicking save I have the following configured.
handler: function() {
var recordsArray = new Array();
var dataRecords = new Array();
recordsArray = grid.getStore().data.items;
for (var i = 0; i < 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 a java class which is able to read the data sent by the ajax request and then I overwrite the data.json file which the store uses to fetch the data. The json file is overwritten without any issue, but the problem is that when I call userStore.load() after sync, it displays the old data, prior to making any changes. Even on refreshing the grid or refreshing the whole page it displays the old data, only when I refresh my entire project in Eclipse and reload the page, then it displays the new overwritten data.
Is this some cache problem? Can someone please tell me what is the issue?