CSS-styling of listbox items isn't consistent across the major browsers. Just use a listbox/combobox from any widget library out there.
On 24 Mrz., 11:13, Danny Schimke <schimk...@googlemail.com> wrote: > My problem is similar. My CSS for <option>- tag's of a select- element are > not shown "dynamically" their new CSS- layout in IE. I'am setting the CSS- > classes like the following: > > listBox.getElement().getElementsByTagName("option").getItem(<index>).setClassName("empty-option"); > > My CSS looks like: > > .empty-option { > color: #F2A336; > > } > > This is only a color- change... > But this color is not shown in IE after adding the class. If I hide and show > the listBox again the colors are updated correctly in IE. But this cannot be > a correct workaround for me... > > Example: > > listBox.getElement().getElementsByTagName("option").getItem(<index>).setClassName("empty-option"); > // after this the color of css class empty-option is shown correctly in FF, > not IE > listBox.setVisible(false); > listBox.setVisible(true); > // now the color is shown correctly in IE too > > This means, that the CSS works in all browsers. It's not a CSS- issue... I > dont know how to fix this. > > -Danny > > 2009/3/24 Shashi Kant <kant.shash...@gmail.com> > > > > > Oh you are using an image. I dont think IE supports that. ,This reason > > behind this is because of how IE gets the "base" for the HTML Select > > tag - it's derived from the Win32api - the same reason why dropdown > > lists and select lists have a nasty habit of rendering "above" > > everything else on the html page. > > > BUT, you could still experiment with background-color. That should > > work like in this example: > > > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > > <title>Untitled Page</title> > > <style type="text/css" media="screen"> > > > .optionBold {background-color: Fuchsia; font-weight: > > bold;} > > > </style> > > </head> > > <body> > > <form id="form1"> > > <div> > > <select id="htmlSelect" multiple="multiple" size="5" > > > <option>Non-styled 1</option> > > <option>Non-styled 2</option> > > <option class="optionBold">Styled</option> > > <option style="background-color: Aqua; font-weight: > > bold;">Styled > > inline</option> > > </select> > > > </div> > > </form> > > </body> > > </html> > > > On Mar 24, 11:01 am, priya <joshipriya...@gmail.com> wrote: > > > Hi Shashi Kant > > > > This is my css code: > > > > .list_box_style{ > > > background-image: url("../images/pkg_image2.bmp"); > > > background-position: right; > > > background-repeat: no-repeat; > > > > } > > > > Is this correct? > > > I don't think this is CSS problem.. > > > Because its working in FF correctly > > > In Safari and IE it's not working.. > > > > If you have another solution then please suggest.. > > > It's really urgent... > > > > On Mar 23, 4:26 pm, Shashi Kant <kant.shash...@gmail.com> wrote: > > > > > This might be a CSS issue > > > > Paste you "list_box_style" here. > > > > > On Mar 23, 4:03 pm, Danny Schimke <schimk...@googlemail.com> wrote: > > > > > > Could it be, that the style is set but not shown. We're adding CSS- > > > > > classnames to option- elements of a listbox too, but only in FF there > > is a > > > > > change visible. Because the listbox for example in IE will not > > refresh its > > > > > GUI after adding styles to its items. I have not found a fix for this > > yet... > > > > > there should be a way to refresh GWT- components on view. > > > > > > -Danny > > > > > > 2009/3/23 priya <joshipriya...@gmail.com> > > > > > > > Hi all, > > > > > > > I have one ListBox in my GWT application. > > > > > > I want to set CSS for some of the items in this ListBox.. > > > > > > > I am using following code for this: > > > > > > > DOM.getChild(listBox.getElement(), i + 1).setClassName > > > > > > ("list_box_style"); > > > > > > > This code is working perfect in Firefox but not working in Safari > > > > > > browser. > > > > > > > I don't know this is problem of DOM.getChild() method or setting > > style > > > > > > for that. > > > > > > > Is Safari supports DOM.getChild() method? > > > > > > > If anyone know another way then please suggest... > > > > > > > Any help is welcome.. > > > > > > > Thanks in advance, > > > > > > > Priya > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---