PDA

View Full Version : Re-sorting array store after modifying data



Zolcsi
14 Nov 2013, 4:28 AM
Hi folks,

I have a grid with an array store attached as the data source. My code keeps modifying the data in the store every second (adding/removing records).
My problem is that the grid is sorted by a column, and the new records keep appearing at the end of the grid. Shouldn't adding records trigger the sorting function?
I guess I could query the sorting info and re-sort the store after every modification but I am not sure if that is the expected behavior of the store.
Could you give me some advice on that?

Thanks!

stephen.aaes
14 Nov 2013, 5:27 AM
Provided you are using local sorting in the store, you can use the addSorted method for new records.

See: http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.Store-method-addSorted


(http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.Store-method-addSorted)

Zolcsi
14 Nov 2013, 5:37 AM
Ohh, how could I miss that... :)
Thanks a lot!