PDA

View Full Version : Dynamically sorting ComboBox



nkezhaya
4 Nov 2011, 4:31 PM
Is this possible? I'd like to use some sort of a method on a ComboBox so that, whenever it's triggered and the options are to be shown, it can resort the data based on a function I provide.

Do I need to create a custom extension for this?

skirtle
4 Nov 2011, 5:10 PM
You should just need to specify a suitable sorter on the store.

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.util.Sorter
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store (see the section 'Filtering and Sorting')
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-sort

nkezhaya
4 Nov 2011, 5:13 PM
That works. Thank you!

mitchellsimoens
5 Nov 2011, 5:57 AM
No worries skirtle, I marked you as having the best answer :)