1
votes

I am using Extjs5. I am trying to insert a record at the first position but the record is getting appended at the end. These are the series of steps followed

store.filter({
     property: fieldName,
 });
store.sort({property: fieldName)}

//Do some operations

store.clearFilter()
delete store.sortInfo;
store.insert(0, record);

The record gets appended to end of the store instead of the beginning. Could anyone please tell me why this happens.

1

1 Answers

2
votes

Your data is getting sorted, delete store.sortInfo is not enough.

Try this code instead:

store.getSorters().clear();
store.getSorters().beginUpdate();
store.getSorters().endUpdate();

Fiddle: http://jsfiddle.net/vnneu76y/1/