5 Replies Latest reply on Jul 6, 2009 10:08 AM by John Who

    problem with columnClasses

    John Who Newbie

      Hi,

      I'm having a table (width="100%") with 6 columns. Each column should have the same size. [Same size is relative easy to achive. Just write one columnClass and place it in the columnClass-attribute of the panelGrid. But is there a posibility to get the column width dynamicly? Because If I'm having a table with 4,5 or 7 columns I don't want to specify each time another columnClass!?!]
      And below this table I'm having another table with only 2 columns. But the first column in the second table should have the same size like the columns in the first table. Ideally the second column should have the widht like "*".

      Thats what I'm thinking of:
      (Table 1)
      |Column1|Column2|Column3|Column4|Column5|Column6|
      |Column1|Column2|Column3|Column4|Column5|Column6|
      |Column1|Column2|Column3|Column4|Column5|Column6|
      (Table 2)
      |Column1|Column2 |

      Any ideas?

        • 1. Re: problem with columnClasses
          John Who Newbie

          Sorry, this is the right format:

          "hrbaer" wrote:

          Thats what I'm thinking of:
          (Table 1)
          |Column1|Column2|Column3|Column4|Column5|Column6|
          |Column1|Column2|Column3|Column4|Column5|Column6|
          |Column1|Column2|Column3|Column4|Column5|Column6|
          (Table 2)
          |Column1|Column2........................................................|


          • 2. Re: problem with columnClasses
            Deb Dutta Novice

            For each column you can use width property with datamodel binding..
            <rich:dataTable var="DATA_ROW"....>
            <rich:column ...width="#{DATA_ROW.colwidth}">

            colwidth is a field of your data model, and there you can set a width so that width will be set at runtime dynamically

            • 3. Re: problem with columnClasses
              John Who Newbie

               

              "user1234" wrote:
              For each column you can use width property with datamodel binding..
              <rich:dataTable var="DATA_ROW"....>
              <rich:column ...width="#{DATA_ROW.colwidth}">

              colwidth is a field of your data model, and there you can set a width so that width will be set at runtime dynamically


              Great! Thank you very much!

              And just another question to my example:
              First table: 6 columns
              Second table 2 columns

              If I want to combine those 2 tables is there a possibility to put something like colspan to my second table?

              I just know how to put more cells into on with the panelGroup-attribute, but what I need is the other way around... any solution for this problem?

              • 4. Re: problem with columnClasses
                Deb Dutta Novice

                " to combine those 2 tables" means??

                your stucture is ..

                Thats what I'm thinking of:
                (Table 1)
                |Column1|Column2|Column3|Column4|Column5|Column6|
                |Column1|Column2|Column3|Column4|Column5|Column6|
                |Column1|Column2|Column3|Column4|Column5|Column6|
                (Table 2)
                |Column1|Column2........................................................|

                for second table, in Column2 you want to put all the cell like of table 1 "Column2|Column3|Column4|Column5|Column6" with in a single colum header??

                for table 2 if its a single cell then give the width like

                table 2 -Column2 = width of table 1 Column2+Column3+Column4+Column5+Column6

                if you want multi cell in a single column,

                use panel group and put <h:outputText > with the required data binding

                you can use colspan if you need it for design.. see the demo link
                http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf
                it might help you

                • 5. Re: problem with columnClasses
                  John Who Newbie

                   

                  "user1234" wrote:

                  you can use colspan if you need it for design.. see the demo link
                  http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf
                  it might help you


                  It does - thank you once again!