6 Replies Latest reply on Dec 2, 2011 3:06 AM by pvito

    Disable the style provided by Richfaces to rich:extendedDataTable

    kh.ramana

      When I am trying to apply the style for the columns in rich:extendedDataTable it is not considering it. ( If I apply the style, width with px it is considering but if I applying the width with percentege ex: 80% It is not working.)

       

      In the attachment i have given one simple data. The columns width is alligned by richfaces style sheet itself. But i want it to be alligned with 80% and 20% for those columns.

       

      I have applied with below code

       

      columnClasses="st1,st2"

       

      .st1 {

          width: 80%;

      }

       

      .st2 {

          width: 20%;

      }

       

      Can any one help me on this... (Disable the width style provided by richfaces and assign the percentage to width mentioned by style classes.)

        • 1. Re: Disable the style provided by Richfaces to rich:extendedDataTable
          pvito

          Hi, Venkataramana Reddy

           

          Use percent for width in column not supported now.

          See source code:

          org\richfaces\renderkit\ExtendedDataTableRenderer.java

           

               /**

               * @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;

              }

          1 of 1 people found this helpful
          • 2. Re: Disable the style provided by Richfaces to rich:extendedDataTable
            kh.ramana

            Thanks for Reply...

             

            Can u give me the .class file by removing the above method from ExtendedDataTableRenderer.java

             

            I tried to generate, but i am not able to convert the ExtendedDataTableRenderer.java to ExtendedDataTableRenderer.class

             

             

            I have removed the method and have attached the Java class. Can u please convert it to .class and provide me.

            • 3. Re: Disable the style provided by Richfaces to rich:extendedDataTable
              mcmurdosound

              I'm not sure, if it's that easy just removing this method.

               

              You do not have to rebuild richfaces, you can configure the richfaces components to use another renderer. This can be done in the faces-config.xml of your project. Section renderkit, renderer? (I don't have the example right on me now). I did this only last week with the rich:messages to show popups (jQuery) instead of tables or lists containing the facesMessages. Just extend the existing ExtendedDataTable and override the method(s). There might be some dependencies which need to be fixed.

               

              (converting java2class is called compiling)

               

              If you want to recompile / rebuild richfaces then you have to checkout the whole project. Till RF 3 it was an svn repository and the richfaces project consisted of many subprojects. (For each UI component for example ...)

              • 4. Re: Disable the style provided by Richfaces to rich:extendedDataTable
                pvito

                Hello, Venkataramana Reddy

                 

                You may use javascript/jQuery for setting column's width in percent.

                • 5. Re: Disable the style provided by Richfaces to rich:extendedDataTable
                  kh.ramana

                  Do u have any code for doing that...

                   

                  My requirement is the table to extend as the screen resolutions increases....

                  • 6. Re: Disable the style provided by Richfaces to rich:extendedDataTable
                    pvito

                    <script type="text/javascript">

                     

                    function setColumnWidth() {

                     

                      tablewidth = jQuery(".rf-edt-tbl-hdr").width();

                     

                      jQuery(".rf-edt-c-j_idt38").css('width',tablewidth*0.4); //40%

                      jQuery(".rf-edt-c-j_idt49").css('width',tablewidth*0.4); //40%

                      jQuery(".rf-edt-c-j_idt50").css('width',tablewidth*0.2); //20%

                     

                    }

                     

                    </script>