PDA

View Full Version : Problem with reload store



hieu79vn
7 Aug 2012, 12:37 AM
Hi
I have a store with memory reader.
For example, at the beginning it will load 4 records


store: Ext.create('Ext.data.Store', {
data: thread_list,
model: 'ThreadList',
proxy: {
type: 'memory',
reader: {
type: 'json'
}
}
}),

Now I reload it with new data. with only 2 records.

Ext.Ajax.request({
url: '<%=WwwRoot%>/abc.aspx?Option=4',
method: 'GET',
scope: this,
success: function ( result, request ){
var data1 = Ext.decode(result.responseText);
alert(result.responseText); // return 2 record data


var gridStore = Ext.getCmp('threadlistgrid').getStore();
gridStore.removeAll();
gridStore.loadData(data1,false);
},
failure: function ( result, request ) {
Ext.Msg.alert('Failed', request.result ? request.result.message : 'No response');
}
});


My problem is that after I call gridStore.loadData(data1,false); the number of record in gridStore is 2 which is good, but the data is not renewed. It show the 2 records of old data which have the same id with the 2 new record.

I dont understand why. Please help

Thank you

scottmartin
24 Aug 2012, 9:24 PM
Let's debug this .. does data1 have the correct data from the server?
Is the data as expected ... correct format?

Also, you should not have to call removeAll with loadData(data1,false)

Scott.