3 Replies Latest reply: Aug 2, 2012 5:47 AM by gimbal2 RSS

    how to change css of f:selectItems


      I am not able to change the css of f:selectItems inside rich:select. I can change CSS of rich:Select successfully unfortunately I do fail when I try to change f:selectItem. You can see the code.. Any help will be appreciated.

      Best Regards


      <h:panelGroup styleClass="mySelectStyle" rendered="#{loginBean.isAuthorize('sigorta') or loginBean.isAuthorize('admin')}" >
      <rich:select id="kurumList" enableManualInput="true"
      defaultLabel=" " rendered="#{not empty kurumListTemp}" styleClass="mySelectStyle" >
      <f:selectItems value="#{kurumListTemp}" var="k"
      itemLabel="#{k.kurumAdi}" itemValue="#{k.kurumKodu}" styleClass="mySelectStyle" />
      <f:ajax event="change" render="toolbar" listener="#{loginBean.kurumAta}"/>

        • 1. Re: how to change css of f:selectItems
          Yes, if you would check the JSF specifications or any result you get by searching google for 'jsf tags' you would see that f:selectItem in fact does not support a styleClass attribute. In stead of just guessing - look up specs and know. Surely that is not a weird concept to you?

          But then you're using Richfaces - and this is not a Richfaces forum. But I'm a nice guy (really!) so I check the Richfaces manual for you - which you could have done yourself. And then I see that the rich:comboBox element supports an 'itemClass', an 'itemSelectedClass' and a 'listClass' attribute. 2 minutes of work. Might be worth investigating.

          Good luck.
          • 2. Re: how to change css of f:selectItems

            My richfaces version does not support rich:comboBox... Unfortunately, I am not able to use rich:comboBox ... : ((
            • 3. Re: how to change css of f:selectItems
              Too bad, better drop the requirement then. A little knowledge of the working environment, which is HTML and CSS in this case, would have told you that there actually are little to none styling choices for select options.