Reputation: 1120
Maybe someone can help me to sort selected items. By default new selected is added to the end of array.
I would like to show them alphabetically, is it possible to do?
I tried to set some listeners on change
but this event is called after selected item is shown on the component.
Any help, or sugestion?
Upvotes: 1
Views: 648
Reputation: 46
I just did this today!
Add a listener on select, and sort them there:
...
"listeners": {
"select": function(combo, records){
records.sort(function(a, b){
//Change value to text or whatever field you want to sort on
return a.data.value - b.data.value;
});
combo.setValue();
combo.setValue(records);
}
},
...
Cheers
Upvotes: 3