:: Forum >>

Dynamic Margin in Combo

I would like to set the style of each line in the combo separately. I know that I can use something like:

obj.getContent("box/image").setStyle("margin-left", "25px");

to set the style for the whole object. Can this also be done for an individual line (or row)?
Brian Crandall
Tuesday, October 6, 2009
The popup is an AW List -

/aw.ui.list/

so you can start by accessing that to get to the individual items.
Anthony
Wednesday, October 7, 2009
Have you tried?
obj.getItemTemplate(index).getContent("box/image").setStyle("margin-left", "25px");
where 'index' is the row in the combo listbox.
HTH
Carlos
Wednesday, October 7, 2009
Perfect, Carlos, just what I needed. I knew there must be a way, I also knew I would never get there on my own.

Thank you!
Brian Crandall
Wednesday, October 7, 2009
This works if there are images, but on combo objects without images it does not indent. Is this an issue with the defined styles or am I missing something?

And as long as I am here, I might as well ask... I cannot find the definition of the background for the combo popup item. I would like to reduce it in size, but cannot locate the code in aw.css.

Thank you.
Brian Crandall
Monday, October 12, 2009
I think the text ("box/text" object) is preceded by the image, so you would also need to add a bigger indent to the Items without image, in the same way you do with image ("box/image"), but really never tried that.
HTH
Carlos
Monday, October 12, 2009
hO! and for your other question, as Anthony said the combos' popup is a simple list object ( contained in a special floating frame/div), so you can get all list properties/methods from the above link.
Carlos
Monday, October 12, 2009
upsss #2
If you are trying to redimension the whole drop-down combo's list container you must refer it by obj.getPopupTemplate() .
Search "getPopupTemplate()" in the forum and will get some samples.
Carlos
Monday, October 12, 2009
Carlos,

Thank you. I did not even realize that I was using "box/image" instead of "box/text". Been looking at this code for too long! My dynamic indent is now working.

What I meant on the background of the combo's popup was the size of the image. I can see in aw.css that it is set as the background, but did not find the width (I realize the height will be set as defined by the font size used).


Brian Crandall
Tuesday, October 13, 2009
for image size, please read:
/javascript.forum.13578.1/button-image-repeat.html
/grid.howto.cells/images.html
Carlos
Tuesday, October 13, 2009

This topic is archived.


Back to support forum

Forum search