问题描述
我正在使用Dojo 1.5,从数据存储区创建一个dijit.form.Select与一些数据。我发现的问题是我想要选择来显示由标识符排序的元素,但是选择是通过标签排序的。如何避免这种行为?我发现的另一个问题是,当我设置商店时,我初始化了商店以选择其中一个元素,但它正在选择第一个。代码如下:
I'm using Dojo 1.5 to create a dijit.form.Select with some data from a datastore. The issue I'm finding is that I want the select to show the elements ordered by the identifier, but the select is ginving them ordered by the label. How can I avoid this behaviour?. Another issue I'm finding is that when I set the store, I initialized the store to select one of the elements, but it is selecting the first one. The code is a 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);
})
它可以在中找到
感谢您的帮助。
推荐答案
只要有人来看,还在dojo兴趣的邮件列表上询问(并已被回答)stion:
Just in case anyone comes looking, this question was also asked (and has been answered) on the dojo-interest mailing list:
资料来源:
这篇关于如何更改dijit.form.Select中元素的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!