2 Replies Latest reply on Feb 21, 2011 2:11 PM by Rodrigo Oliveira

    Autocomplete, how to change width

    Rodrigo Oliveira Newbie

      Hello everyone,

       

      I am using the rich:autocomplete component from Richfaces 4 milestone 5 and everything works fine, but I can't change the width of the component or of the returned itens. As some of the itens returned are wider, they are being cut.

       

      I don't see any property like style, styleclass or width on the component. I have tried to change the width using javascript and it works, but when we stretch it, it seems that there is an image on the background that gets weird.

       

      Please, I really need help as we are evaluating using richfaces 4 in several projects that we are starting now.

       

      Thank you,

       

      Rodrigo Oliveira

        • 1. Re: Autocomplete, how to change width
          Juan Camilo Prada Newbie

          setting the Id for the component and defining a custom rule in your own CSS file is not an option?... I would try that with an !important modifier for the rule so it wont be overrided by richfaces rules. i.e #myComponentId { width: 150px !important; }

          • 2. Re: Autocomplete, how to change width
            Rodrigo Oliveira Newbie

            Thank you Juan,

            I was finally able to do it. The component end up generating lots of divs on the page. I had to change the width of the component and also change the class of one of those divs generated, like this:

             

            <style type="text/css">

                            #myComponentID { width: 400px !important; }

                            .rf-au-lst-scrl    { width: 400px !important; text-align: left; }

            </style>

             

            This css class (rf-au-lst-scrl) is used by the component and there seems to be no way of changing it on the component. I hope in future releases there are easier ways to change it besides looking the generated code and trying with the classes in the divs. Adding a styleClass or even a width on the autoCompelte would be nice.

            Anyway, thanks a lot Juan Camilo.