How to change the order of elements in dijit.form.Select

I am using Dojo 1.5 to create dijit.form.Select with some data from the data warehouse. The problem I find is that I want the selection to display items sorted by identifier, but select ginving them sorted by label. How can I avoid this behavior? Another problem that I discovered is that when I install the repository, I initialized the repository to select one of the items, but it selects the first. The code is as follows:

dojo.require("dijit.form.Select"); dojo.require('dojo.data.ItemFileReadStore'); dojo.addOnLoad(function(){ var boxContent = {"identifier":"idBox","items":[{"accessLevel":"FULL_ACCESS", "boxName":"My Documents","boxType":"PERSONAL","idBox":1512,"numberFiles":9, "userDisplayName":"Jose Luis Martinez Avial","userName":"MIAMARA"}, {"accessLevel":"FULL_ACCESS","boxName":"12312312","boxType":"PERSONAL", "idBox":17100,"numberFiles":0,"userDisplayName":"Jose Luis MartinezAvial", "userName":"MIAMARA"}],"label":"boxName"}; var myStore = new dojo.data.ItemFileReadStore({data: boxContent }); var boxCombo= new dijit.form.Select({ name: 'select2' }).placeAt(dojo.body()); boxCombo.setStore(myStore,1512); }) 

It is available at http://jsfiddle.net/m9ucX/1/

Thank you for your help.

+6
select dojo order
source share
1 answer

Just in case, when someone comes, this question was also asked (and answered) on the dojo -interest mailing list:

I think you will get what you want if you just set sortByLabel: false on select "Select".

A source:
http://mail.dojotoolkit.org/pipermail/dojo-interest/2011-February/052328.html

+6
source share

All Articles