dojo选择设置最大宽度 [英] dojo select set maximum width
问题描述
我的dojo选择的宽度有问题。选择窗口小部件的选项由ajax调用填充。一些标签是非常长的,并且选定小部件的宽度随着标签的大小而增长。有没有办法设置选择小部件的最大宽度?那么宽度不会超过180px? PS:我通过编程方式实现小部件,如
new Select({
name:select2
))。placeAt(win.body())
编辑:这里例如 http://jsfiddle.net/5r3gR/3/ 当我选择VeryVeryVeryLongLabel时,选择dijit变化的宽度但是它应该保持在宽度上。
我用claro主题添加了...
.dijitSelectLabel {
text-align:left;
overflow:hidden;
width:100px;
}
这使得文本框的宽度为100px静态。下拉列表选项仍将扩展到您选项的最大宽度
.bigSelect .dijitSelectLabel {
text-align:left;
overflow:hidden;
width:200px;
}
.smallSelect .dijitSelectLabel {
text-align:left;
overflow:hidden;
width:100px;
}
代码
var big = new选择({
store:os,
class:bigSelect
},target ;
var small = new选择({
store:os,
class:smallSelect
},target);
i have a problem with the width of my dojo select. The option of the select widget are filled by an ajax call. A few of the labels are very long and the width of the select widget grows with the large of the label. Is there a way to set the maximum width of the select widget? So that the width don't grow over 180px? PS: I implement the widget by programmatically way like
new Select({
name: "select2"
}).placeAt(win.body())
Edit: Here for example http://jsfiddle.net/5r3gR/3/ when i select the "VeryVeryVeryLongLabel" the width of the select dijit changes but it should stay at the width.
I used the claro theme with the added rule of...
.dijitSelectLabel {
text-align:left;
overflow: hidden;
width:100px;
}
Which makes the width of the textbox static at 100px. The dropdown options will still expand out to the biggest width of your option
To style different selects with different widths make the following changes
Css
.bigSelect .dijitSelectLabel {
text-align:left;
overflow: hidden;
width:200px;
}
.smallSelect .dijitSelectLabel {
text-align:left;
overflow: hidden;
width:100px;
}
Code
var big = new Select({
store: os,
class: "bigSelect"
}, "target");
var small = new Select({
store: os,
class: "smallSelect"
}, "target");
这篇关于dojo选择设置最大宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!