4 Replies Latest reply on Dec 9, 2011 2:24 PM by bcn

    Controlling column widths of rich:autocomplete?

    sbalmos1

      Hi,

       

      I'm currently finishing up a migration of <rich:suggestionbox> in our 3.3 app to <rich:autocomplete> in a 4.0 version. However, with <rich:suggestionbox>, we could control the widths of the individual columns that made up the suggestion box - namely so that the text contents would not word-wrap. I have tried everything I can think of to change the column widths with <rich:autocomplete>, to no real success. At best, I can change the width of the popup box overall. But the columns do not expand to use the extra width. They seem to be hard-coded to some width, causing the text inside to word-wrap. New code is below:

       

                  <rich:autocomplete id="employeeSearchName" mode="ajax" minChars="3"

                                     autocompleteMethod="#{employeeSearchBean.searchEmployees}" var="emp"

                                     autofill="false" layout="table"

                                     fetchValue="#{emp.employee.id}" value="#{employeeSearchBean.selectedEmployeeName}"

                                     onselectitem="chooseEmployee()" popupClass="popup">

                      <rich:column style="width: 100px">

                          <h:outputText value="#{emp.maskedSsn}" styleClass="#{emp.displayStyle}"/>

                      </rich:column>

                      <rich:column style="width: 175px">

                          <h:outputText value="#{emp.nameLfm}" styleClass="#{emp.displayStyle}"/>

                      </rich:column>

                      <rich:column style="width: 175px">

                          <h:outputText value="#{emp.companyLocation}" styleClass="#{emp.displayStyle}"/>

                      </rich:column>

                  </rich:autocomplete>

       

      No matter whether I use style="width: ?", width="?", or any attributes on the individual <rich:column> definitions, the width is always the same - too short for our visual desires.

       

      Can anyone throw a hint at what's required? Thanks.

        • 1. Re: Controlling column widths of rich:autocomplete?
          rlmarsh85

          Scott,

           

          I am facing the same exact problem. I will post and let you know if I find an answer.

          • 2. Re: Controlling column widths of rich:autocomplete?
            rlmarsh85

            This solution came quicker than I anticipated. Looks like we're not the only two having a hard time. Read this thread:

             

             

            http://community.jboss.org/message/610809

            1 of 1 people found this helpful
            • 3. Re: Controlling column widths of rich:autocomplete?
              sbalmos1

              Well... Honestly it looks like another oversight / hack job. But it works. I added the rf-au-lst-scrl override, which works fine. But ultimately, the width attribute of the contained <rich:column> elements is still being ignored. I don't care too much, since everything seems to be rendering close to how it used to. But I think it's still an oversight.

               

              Also interesting to note, in the rendered table for the popup list, I had to define td.rf-au-inp { padding-right: 5px; } to properly mimic the slight cell spacing in the old 3.3 suggestionbox. Otherwise, the cells are scrunched up right next to each other - visually annoying. Looking at the generated HTML, each cell's td element references a rf-au-inp class that doesn't exist. There's input.rf-au-inp, for the text input box itself. But no td.rf-au-inp or such. Additional FYI.

              • 4. Re: Controlling column widths of rich:autocomplete?
                bcn

                Hi,

                 

                I think one should file a bug / enhancement request.

                Because, even with this workaround you cannot change the width of one autocomplete on a page without changing others on the same page, can you?

                Another doubt, if the default width is 100%, why does it not adapt to the item widths automatically?

                 

                Thanks