ExtJS JsonStore Add/Remove/Sort

492 Views Asked by At

I've created a list view that relies on a JsonStore.

This list is updated in real-time. What this means is that I receive records to be updated and I remove the existing ones from the store. I then place back in the updated ones and perform a sort. On each update this can mean that 5-10 records are removed and replaced.

My problem is that if I place a sort operation into the "add" listener I find duplicates in the view (but not the store). My best guess is that the sort operation uses some sort of cache.

I'm using ExtJS 2.3.0. Any ideas as to why this might be happening?

EDIT: Some sample code for what I'm doing:

This is in the success event of an ajax call for new data...

var updatedRows = [];
var rowData = Ext.decode(response.responseText);
for ( var x = 0; x < rowData.rows.length; x++ ) {
    var index = store.find('rowID', rowData.rows[x].rowID);
    store.removeAt(index);
    // create new record and use store.add()
}
0

There are 0 best solutions below