6 Replies Latest reply on Sep 1, 2012 6:58 AM by Sergey Morenets

    columnsWidth official support in RF 4.x

    Sergey Morenets Novice

      Hi, guys

       

      As rich:column doesn't have width property now I tried to investigate the best replacement of it.

      It seems that columnsWidth property allows to change column widths for the whole table. I see this property

      in the sources and it really works.

       

      However I don't see any reference about it in the documentation. Is it officially supported? I wonder if it is temporary

      functionaliy which might silently disappear.

       

      http://docs.jboss.org/richfaces/latest_4_2_X/vdldoc/rich/dataTable.html

        • 1. Re: columnsWidth official support in RF 4.x
          Brendan Healey Master

          It does have a width attribute, i.e. rich:column width="100px"

           

          Regards,

          Brendan.

          1 of 1 people found this helpful
          • 2. Re: columnsWidth official support in RF 4.x
            Sergey Morenets Novice

            Sorry, Brendan.

             

            Yes, it does have the width attribute according to the documentation.

            However it is not actually used. Here is my sample that worked in 3.3.3

             

            <rich:dataTable value="#{products}" 
            var="product" styleClass="maxwidth" rows="15" rowClasses="each-row"
            headerClass="header-row">
            <rich:column sortBy="#{product.name}">
            <f:facet name="header">
            <h:outputText value="#{msg['product.name']}" />
            </f:facet>
            <h:outputText value="#{product.name}" />
            </rich:column>
            <rich:column width="30px">
            <h:graphicImage url="/resources/images/edit.gif" alt="Edit" />
            </rich:column>
            </rich:dataTable>

             

            The width of the second column is arbitrary until I setup columnsWidth=",30px" for the whole table.

            I use RF 4.2.2

            • 3. Re: columnsWidth official support in RF 4.x
              Brendan Healey Master

              I think the problem is that you're not specifying a width for the first column, it works ok for me so try this and

              see if it helps. I don't think you should have to but...

               

              Regards,

              Brendan.

              • 4. Re: columnsWidth official support in RF 4.x
                Sergey Morenets Novice

                Brendan, can you please post your example?

                I've simplified my usecase and specified width for both columns but width is still not applied ....

                 

                <rich:dataTable value="#{products}" 
                var="product" style="width:100%">
                <rich:column width="200px">
                <h:outputText value="#{product.name}" />
                </rich:column>
                <rich:column width="200px">
                <h:graphicImage url="/resources/images/edit.gif" alt="Edit" />
                </rich:column>
                </rich:dataTable>
                • 5. Re: columnsWidth official support in RF 4.x
                  Brendan Healey Master

                  Hi Sergey, I just use rich:column width="nnnpx" all the way through. Try removing the style="width: 100%". I have to admit

                  that mostly I'm using extendedDataTable but I have successfully used this on dataTable. What is the outer container of the

                  dataTable, what is the display: css value? for example if you use display: inline-block the table won't take up the full

                  container width.

                   

                  Regards,

                  Brendan.

                  • 6. Re: columnsWidth official support in RF 4.x
                    Sergey Morenets Novice

                    Hi, Brendan.

                     

                    Unfortunately I cannot remove style="width:100%" because I want that my table was the same width as its container.

                    I deployed and changed a bit showcase application(Data Table Sorting sample). Here it is(changed version)

                     

                    <h:form>
                    <rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table" style="width:100%">
                    <rich:column width="50px">
                    <f:facet name="header">
                    State Flag
                    </f:facet>
                    <h:graphicImage value="#{cap.stateFlag}" alt="flag" />
                    </rich:column>
                    <rich:column sortBy="#{cap.name}" id="name"
                    sortOrder="#{capitalsSortingBean.capitalsOrder}">
                    <f:facet name="header">
                    <a4j:commandLink value="Sort by Capital Name" render="table"
                    action="#{capitalsSortingBean.sortByCapitals}" />
                    </f:facet>
                    <h:outputText value="#{cap.name}" />
                    </rich:column>
                    </rich:dataTable>
                    </h:form>

                     

                    Unfortunately the column width hasn't changed.

                    There are two ways to change this behavior:

                     

                    1) Use columnsWidth="50px," for the whole table

                    2) Use style="width:50px" for the specified column.

                     

                    So it seems like width attribute is still not applied.