3 Replies Latest reply on Aug 31, 2012 6:04 AM by Sergey Morenets

    rich:column ignores width attribute in RF 4.1

    Newbie

      I appreciate if you can provide some pointers on this issue.

       

      My Environmnet: RF 4.1.0, JSF 2.1.3, jstl* 1.2, el-impl/api 2.2 running on JDK 1.6, Tomcat 7.0x within Eclipse Helios with JBoss Tools installed.

       

      .xhtml file

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"

                xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:dt="http://java.sun.com/jsf/composite/ertjsfPages">

       

       

                <!-- <h:outputStylesheet name="mdert.css" library="css" /> -->

                <f:view>

                          <h:head>

                                    <title>Test Pages</title>                  

                          </h:head>

                          <h:body>

                                    <h:form id="inquiryForm">

                                                   <h:panelGrid id="samplePanel" width="100%" columns="5">

                                                        <rich:column width="5%">

                                                                  <h:outputText value="Enter your Student Name: " />

                                                        </rich:column>

                                                        <rich:column width="2%">

                                                                  <h:outputText id="sName" value="Bright" />

                                                        </rich:column>

                                                        <rich:column width="15%">

                                                                  <h:outputText value="Enter your Class" for="sClass" />

                                                        </rich:column>

                                                        <rich:column width="20%">

                                                                  <h:outputText id="sClass" value="Grade: IV" />

                                                        </rich:column>

                                                          <rich:column width="50%">

                                                                  <h:panelGroup>

                                                                            <h:outputText value="Enter others...." />

                                                                            <h:outputText id="sMarks" value="Marks: 10" />

                                                                            <h:outputText id="sPer" value="Percentage: 10%" />

                                                                            <h:outputText id="sGrade" value="Fail" />

                                                                  </h:panelGroup>

                                                        </rich:column>

                                              </h:panelGrid>

       

        </h:form>

                          </h:body>

                </f:view>

      </ui:composition>

       

      The generated html output when seen in the browser clearly does not have width attribute in <td>

       

      <head>

      <title>Test Pages</title>

      </style>

      </head>

      <body>

                <form id="inquiryForm" name="inquiryForm" method="post" action="/mdert/testPages/testTableColumn.jsf" enctype="application/x-www-form-urlencoded">

                          <input type="hidden" name="inquiryForm" value="inquiryForm" />

                          <table id="inquiryForm:samplePanel" width="100%">

                                    <tbody>

                                              <tr>

      <td>Enter your Student Name:</td>

                                                        <td><span id="inquiryForm:sName">Bright</span></td>

                                                        <td>Enter your Class</td>

                                                        <td><span id="inquiryForm:sClass">Grade: IV</span></td>

                                                        <td>Enter others....<span id="inquiryForm:sMarks">Marks: 10</span><span id="inquiryForm:sPer">Percentage: 10%</span><span id="inquiryForm:sGrade">Fail</span></td>

                                              </tr>

                                    </tbody>

                          </table>

                          <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-7583018661658982752:-2778455712605358580" autocomplete="off" />

                </form>

      </body>

        • 1. Re: rich:column ignores width attribute in RF 4.1
          Vitaliy Pavlov Novice

          Hi, Prabhakar Ganji

           

          Use percent for width in rich:column not supported now.

          I'm find that in source code:

           

               /**

               * @deprecated TODO Remove this method when width in relative units in columns will be implemented.

               * @param column

               * @return width

               */

              private String getColumnWidth(UIComponent column) {

                  String width = (String) column.getAttributes().get("width");

                  if (width == null || width.length() == 0 || width.indexOf("%") != -1) {

                      width = "100px";

                  }

                  return width;

              }

           

          Regards, Vitaliy

          • 2. Re: rich:column ignores width attribute in RF 4.1
            Newbie

            Thank you for your efforts and I apologize for late reply. I've tried widths with just numbers, with and without % and with px but still no width attribute is being ouputed in generated <td> by rich:column.


             

            I set break point in org.richfaces.renderkit.ExtendedDataTableRenderer   private String getColumnWidth(UIComponent column) method, it did not hit at all.


             

            I spent some time to figure out which renderer is being applied to render <rich:column> but could not figure it out.


             

            To factor out all the issues related to environment, I downloaded showcase example, prepared a war and deployed on my Tomcat 6. I moved the page (with above code) to the showcase application and I still see the same output.

             


            I wonder if rich:column has issues with width attribute if so what are the options. It’s really pain as moved JSF 1.2 and RF 3.3.3 based application to JSF 2x and RF 4.1 and then found all the page layout is gone with RF4.1 as rich:column does not render width attribute with <td>.


             

            I already worked out the layout with <h:column> with <h:panelGrid> column classes but it will be pain to replace all the pages.

             

             

            Any help is much appreciated.

             

            --Prabhakar

            • 3. Re: rich:column ignores width attribute in RF 4.1
              Sergey Morenets Novice

              Hi, Prabhakar

               

              It seems that width propertly was removed from rich:column(at least, for RF 4.2). I don't see it the documentation and sources.

              Sorry to tell about that, it was really widespread in my application in 3.3.3.

               

              As it often happened no word about this change in the manual

               

              https://community.jboss.org/wiki/RichFacesMigrationGuide33x-4xMigration-ComponentsMigration-RichIterationComponents