3 Replies Latest reply on May 19, 2009 4:30 AM by raphael_lemaire

    Only display headers in first subtable  ?

      Hello rich faces users !

      I have a question for you.

      I have a rich:dataTable which include an inner rich:dataTable :

      <rich:dataTable value="#{firstCollection}" var="item" rowKeyVar="rowKey">
      <rich:column>
      ...
      </rich:column>
      <rich:column>
      <f:facet name="header">
      <h:outputText value="Azerty" />
      </f:facet>
      <rich:dataTable value="#{item.otherCollection}" var="item2" >
      <rich:column>
      <f:facet name="header" rendered="?">
      <h:outputText value="Qwetry" />
      </f:facet>
      ...
      </rich:column>
      </rich:dataTable>
      </rich:column>
      </rich:dataTable>

      For the inner data tables I only want the headers diplayed for the first row of the top level data table.

      Is there any clean way to do this ?

        • 1. Re: Only display headers in first subtable  ?
          ilya_shaikovsky

          if I get your case right - just use subtable instead of nested dataTAble. It encodes table structure but without nested table element. And puts its headers to parent table headers.

          • 2. Re: Only display headers in first subtable  ?

            Hi Ilya Shaikovsky, thanks for your answer.

            I tried rich:subTable but it's not quite what I want : for each row of the parent table, it adds a row of headers and all rows of the "subtable". The rows of the "subTable" are rows of the parent table ! (This tag is weird ...).

            I want to keep the sub tables as nested tables, but only display the headers for the first line of the parent table.

            I managed to do it by declaring two almost identical sub tables, one with the "f:facet" headers, rendered only if it's the first row ("#{rowKey == 0}"), and one without headers rendered if it's not the first row ("#{rowKey != 0}"). But in this case I have duplication. That's why I asked for a clean way.

            Beside f:facet does not have a rendered attribute, otherwise it would be very simple.

            • 3. Re: Only display headers in first subtable  ?

              No idea ?

              Maybe it's not possible ?