1 Reply Latest reply on Feb 26, 2009 6:15 PM by nbelaevski

    Still the problem with dataTable and column

    thomas.m

      Hi,

      I have a dataTable to display simple object data. For a specific type of object, I want to "hide" one column as the data is irrelevant for this object type. The problem is when the page is displayed, the data column is hidden, but the column header is still there.

      Here is my code, notice how the first column rendering is checked :

      <rich:dataTable value="#{workspace.events}" var="event">
      
      <rich:column rendered="#{not event.noName}">
       <f:facet name="header">
       <h:outputText value="#{labels['event.infos.name']}" />
       </f:facet>
       <h:outputText value="#{event.name}" />
      </rich:column>
      
      <rich:column>
       <f:facet name="header">
       <h:outputText value="#{labels['event.infos.start']}" />
       </f:facet>
       <h:outputText value="#{event.openDate}" />
      </rich:column>
      
      <rich:column>
       <f:facet name="header">
       <h:outputText value="#{labels['event.infos.stop']}" />
       </f:facet>
       <h:outputText value="#{event.closeDate}" />
      </rich:column>
      
      </rich:dataTable>
      


      I checked the value of 'event.noName' value and it is set correctly. I thought this issue was fixed with 3.3.0... Anyone have a workaround ?

      I tried making a columnGroup and hiding the outputText in the columnGroup : not working
      I tried adding a rendered attribute on the facet outputText : not working (display an empty header)
      I tried to surrond my column with an a4j:region and putting the rendered attribute on the region : not working...

      Please help me! Thanks !


        • 1. Re: Still the problem with dataTable and column
          nbelaevski

          Hello,

          "event" variable is not accessible when header is rendered, so it's evaluates to true - add this to the page and check:

          #{not any.property}
          . Most likely this limitation won't be addressed, I suggest that you implement additional logic in bean that will define whether this column is rendered or not not depending on "var" value.