jbailie1991
jbailie1991

Reputation: 1345

Dojo: Sorting a widgets store object

Is there a way to take a dojo widget object and sort its store, e.g. by alphabetical order etc?

Initially I thought about copying the store, sorting it and replacing the original with it but is there any way to do it directly on the widget object without this step?

Upvotes: 2

Views: 1071

Answers (1)

inanutshellus
inanutshellus

Reputation: 10001

Given that your widget is a (customized) FilteringSelect... try this:

<select 
     data-dojo-type="dijit/form/FilteringSelect"  
     data-dojo-props=" 
         searchAttr: 'foo',  
         labelAttr: 'bar',  
         fetchProperties:{sort:[{attribute:'baz',descending:false}]} 
     "></select>

With handy dandy jsfiddle.

Upvotes: 6

Related Questions