PDA

View Full Version : Style problems with ComboBox



casbar
11 Aug 2009, 3:25 AM
Hello,
I want to put a 5px margin on a ComboBox...
The problem is that the margin will be put between the textfield and the little combobox arrow...

http://img171.imageshack.us/img171/8018/clipboard03r.jpg

Some ideas?
Thanks,
casbar

Condor
11 Aug 2009, 3:35 AM
You have to put the margin on the wrap <div> and not on the el <input>.

casbar
11 Aug 2009, 3:40 AM
So it isn't possible to add the style as a parameter like this?


new Ext.form.ComboBox({
[...]
style: 'margin:5px;',
[...]
)};

Condor
11 Aug 2009, 3:46 AM
There is no config option for that. You'll have to use:

new Ext.form.ComboBox({
[...]
onRender: function(ct, position){
this.constructor.prototype.onRender.apply(this, arguments);
this.wrap.applyStyles('margin:5px;');
}
[...]
)};

casbar
11 Aug 2009, 7:22 AM
Thank you it works, but now I have a new problem :D
How youcan see in the attachment the dropdown box has not the same position like the field...
Sorry for my little problems but I really dont know how to fix this problems...

casbar

Condor
11 Aug 2009, 7:31 AM
How are these comboboxes rendered? Inside a layout? Can't the layout do the spacing for you?

casbar
11 Aug 2009, 7:37 AM
It's a little problem.... the second combobox (the right one) will be dynamically created after selecting something in the first one...
In this case i would use a table layout, but in Ext2.2 it isn't possible to add components to a table layout, the second combobox would be under the first one.

So I have to set the position with CSS ! (:|

I hope you can find a solution, because I dont know one!

casbar

Condor
11 Aug 2009, 9:14 AM
There is a fix in the Ext 2.x Bugs forum for TableLayout to allow adding components.

casbar
12 Aug 2009, 2:01 AM
Cool I found it! Thanks very much!

Now I have a tablelayout with 2 columns and if only one is occupied by a field,
and in the next step i remove every item with removeAll(), make a doLayout() and add a new field, the new field will appear in the second column... :( Why?

Is it necessary to do like a reset of the layout or something like this? Or is it may be possible to say them in which column the field has to be put in?

Thank you,
casbar

Condor
12 Aug 2009, 2:12 AM
TableLayout can't remove td elements, only add them.

Maybe you should always create the two components, but hide the second one.