0 Replies Latest reply on Jun 7, 2011 1:47 PM by Albert Itkin

    Dynamic datatable

    Albert Itkin Newbie

      I'm trying to build Datatable, where source of some columns (field name) are determined at Run Time. I tried a few ways without success. Here my attempts:

       

      <rich:extendedDataTable value="#{bSBean.itemsRS}" var="items">

       

       

         <rich:column width="120px"  style="text-align: right" >

          <f:facet name="header">

           <h:outputText value="#{bSBean.keyFigColumns[0]}" styleClass="field-label"/>

          </f:facet>   

          <h:outputText value="#{items.#{bSBean.keyFigColumns[0]}}">

           <f:convertNumber pattern="###,###,##0.00" />

          </h:outputText >

         </rich:column>

       

      here bSBean.keyFigColumns[0] returns "field1"

      Works for the header, but not for the field itself.

       

      Another attempt with ui:include:

       

       

        <ui:include src="KeyFigColumn.xhtml">

           <ui:param name="columnCaption" value="#{bSBean.keyFigColumns[0]}"/>

           <ui:param name="columnSource" value="#{bSBean.keyFigSource[0]}"/>

       

          </ui:include>

       

      KeyFigColumn.xhtml"

       

      <rich:column width="120px"  style="text-align: right" >

        <f:facet name="header">

         <h:outputText value="#{columnCaption}" styleClass="field-label"/>

          </f:facet>   

          <h:outputText value="#{columnSource}">

           <f:convertNumber pattern="###,###,##0.00" />

          </h:outputText >

         </rich:column> 

       

       

      here bSBean.keyFigSource[0] returns "#{items.field1}

       

      but table displays #{items.field1} in every row instead of content of field1.

       

      Is there any way to accomplish this task?