views:

29

answers:

2

I have a programmatically generated dijit.form.Select. Unlike most other widgets, the Selects do not offer a resize method like

dijit.resize({w: width, h: height});

I have not found a standardized way of setting the width of a select. This is quite bad because the autosizing makes Dialogs "explode" on long select values.

Is there a standard way to resize a select I have missed? Or do I have mess with the markup of the select the hard way?

Thanks!

A: 

I would use

dojo.marginBox(selectWidget.domNode, {w: width, h:height})
Bishnu
Thanks for the answer! Tried that already, but that screws up the select dijit (the dropdown arrow on the right fills out the additional width, the real select value stays autosized as before). Guess I'll have to modify it the hard way, thanks anyway!
Steffen Müller
+1  A: 

Why wouldn't you simply do this by setting the widget's style?

http://jsfiddle.net/QEjYD/1/

Unfortunately, due to how the widget is written, this doesn't work if you hook up the width in a CSS class, or if you set the width style after the widget has been created.

Ken
Thank you! That was actually the problem: I needed to resize the select AFTER the widget has been created. Was not aware of the fact that it works before creation.
Steffen Müller