6 Replies Latest reply on Apr 27, 2010 5:40 AM by ilya_shaikovsky

    dataTable column width problem oddity

    peterlen

      Hello,

       

      I have a rich:dataTable that lives within a rich:modalPanel.  The modalPanel has the attribute autosized set to true so that the panel is only as big as the contents of the table.  The table itself has 5 columns at the moment.  The problem is that values within the columns are being auto-wrapped when the text goes beyond the width of the column's facet name, thus the column is only as wide as the name given to the facet for the column. For example, the first row might look like (Title is the column facet name):

       

        Title

      This

      is a

      long

      title

      here

       

      I have tried to add a width attribute both to the column as well as the dataTable itself but that is not changing it.  I also tried to add the width via the style tag but nothing there as well.

       

      Does anyone know how the column can be set to be a certain width so that the text wrapping is not happening on virtually every space.

       

      Thanks - Peter

        • 1. Re: dataTable column width problem oddity
          nbelaevski

          Hi Peter,

           

          Try "columnsWidth" attribute.

          • 2. Re: dataTable column width problem oddity
            peterlen

            Nick,

             

            Thanks for the reponse.  Yeah, I tried the columnsWidth attribute as well.  That works if my table was not in the modalPanel.  I think the issue is really tied to having the table in a modalPanel that is autosized.  When the modalPanel is sized based on a pre-determined height/width, you seem to be able to have more of the column/table attibutes triggered, but not when it is autosized.  Still trying to figure it out.

             

            - Peter

            • 3. Re: dataTable column width problem oddity
              ilya_shaikovsky

              width attribute of rich:column and dataTable should works for that.

               

              I checked without any width's declarations and result attached.

              • 4. Re: dataTable column width problem oddity
                ilya_shaikovsky

                show please your code. and check also css applied.

                • 5. Re: dataTable column width problem oddity
                  peterlen

                  Ilya,

                   

                  Thanks for the repsone.  The behavior I am seeing in IE7 and FF2 is that the width and columnsWidth attributes are only executed if the modalPanel has a defined height and width.  If it is defines with "autosized='true'", then the extra width is not rendered.   Here is my code:

                   

                  <rich:modalPanel id="result_table2_panel" autosized="true" styleClass="noMaskClass">

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                    <h:panelGrid>

                     <rich:dataTable id=

                  "rt2" rows="10" value="#{Planning.resultsTable}" var="results">

                         <rich:column sortBy=

                  "#{results.name}" width="300">

                            <f:facet name=

                  "header" width="300px">

                              <h:outputText value

                  "Name" />

                            </f:facet>

                            <h:outputText value=

                  "#{results.name}" />

                        </rich:column>

                       <rich:column sortBy="#{results.date}" >

                          <f:facet name=

                  "header">

                            <h:outputText value="Date"/>

                          </f:facet>

                          <h:outputText value=

                  "#{results.date}"/>

                      </rich:column>

                    </rich:dataTable>

                  </h:panelGrid>

                  </rich:modalPanel>

                   

                   

                  When I switched the above the have a fixed width and height for the modalPanel, the column width attribute worked.  Once I used the autosized attribute it would not work.

                   

                  - Peter

                  • 6. Re: dataTable column width problem oddity
                    ilya_shaikovsky

                    Yes.. it was a bad test on my side.. There are stings without spaces so things was ok.. Now able to see that. And next workaround helped me:

                     

                    <rich:column>
                         <f:facet name="header">
                              <h:outputText value="a" />
                         </f:facet>
                         <div style="width: 300px">
                              <h:outputText value="#{category.make} test" id="make" />
                         </div>
                    </rich:column>