1 Reply Latest reply on Jan 29, 2009 6:08 AM by andrei_exadel

    DataTable with Dynamic Columns in DataGrid

    repkin

      Hi,

      I am trying to generate dynamic columns. I am using dataTable in the dataGrid, because dataTables' column list is changing for every dataTable. I have tried something like that bu it is not working;

      
      <rich:dataGrid value="#{generalCommissionController.distributionPartyLimitWrapperList}" var="distributionPartyLimitWrapper" columns="1" elements="5" width="100%">
       <rich:dataTable value="#{distributionPartyLimitWrapper.distributionPartyLimit}" cellpadding="0" cellspacing="0" width="700" border="0">
       <rich:columns value="#{distributionPartyLimitWrapper.distPartyCreditRangeColl}" var="distPartyCreditRange">
       <f:facet name="header">
       <h:outputText value="#{distPartyCreditRange.minimumCredit}"/> - <h:outputText value="#{distPartyCreditRange.maximumCredit}"/>
       </f:facet>
       <h:outputText value="test"/>
       </rich:columns>
       </rich:dataTable>
       <f:facet name="footer">
       <rich:datascroller></rich:datascroller>
       </f:facet>
      </rich:dataGrid>
      
      


      Can you help me, please :(...

        • 1. Re: DataTable with Dynamic Columns in DataGrid

          Hi,

          The cause of the problem is 'distributionPartyLimitWrapper' request variable that inits in dataGrid component on render phase.
          But dynamic columns needs this value on tag applying phase.

          Solution for this case is to use <c:forEach> tag instead of dataGrid.
          It inits the variables on tag applying phase.