4 Replies Latest reply on Sep 17, 2008 5:39 AM by Ilya Shaikovsky

    How to popule a grid (rich:extendedDataTable)?

    Inocêncio Oliveira Newbie

      I have done the grid design using this component. In the value attribute I have setted: value="#{MyBean.lstClients}, where lstclients is a List class type.

      The problem is the table don´t render with populated datas. I saw in somewhere I need to build a DataModel object to populate the table, but how?

      Thanks all.

        • 1. Re: How to popule a grid (rich:extendedDataTable)?
          Inocêncio Oliveira Newbie

          I´m trying to use SerializableDataModel, If I get some result I post again here.

          • 2. Re: How to popule a grid (rich:extendedDataTable)?
            Nick Belaevski Master

            Hello,

            ExtendedDataTable works with List type, you do not need to create your own data model. Can you please post full page and bean code?

            • 3. Re: How to popule a grid (rich:extendedDataTable)?
              Inocêncio Oliveira Newbie

              Thank you nbelaevski, for your answer.


              My JSP

               <h:panelGrid columns="1">
               <rich:extendedDataTable id="tblComissao" value="#{ComissaoLst.lstComissao}" var="tblComissao"
               width="800px" height="250px" selectedClass="dataTableSelectedRow"
               sortMode="single" selectionMode="multi" selection="#{extendedDT.selection}"
               rowKeyVar="rkvar" tableState="#{extendedDT.tableState}">
               <rich:column id="unidade" headerClass="dataTableHeader" width="150" label="Unidade" sortable="true"
               sortBy="#{tblComissao.unidadeComissao}" sortIconAscending="dataTableAscIcon"
               filterBy="#{tblComissao.unidadeComissao}"
               sortIconDescending="dataTableDescIcon">
               <f:facet name="header">
               <h:outputText value="Unidade" />
               </f:facet>
               <h:outputText value="#{tblComissao.unidadeComissao}" />
               </rich:column>
               <rich:column id="dataInicio" width="150" headerClass="dataTableHeader" label="DataInicio" sortable="true"
               sortBy="#{tblComissao.dataAtuacaoInicio}" sortIconAscending="dataTableAscIcon"
               sortIconDescending="dataTableDescIcon" filterBy="#{tblComissao.dataAtuacaoInicio}"
               filterEvent="onkeyup" visible="false" title="Atuação da Comissão">
               <f:facet name="header">
               <h:outputText value="InÃÂcio" />
               </f:facet>
               <h:outputText value="#{tblComissao.dataAtuacaoInicio}">
               <f:convertDateTime pattern="dd/MM/yyyy"/>
               </h:outputText>
               </rich:column>
               <rich:column id="dataTermino" width="150" headerClass="dataTableHeader" label="DataTermino"
               sortable="true" sortBy="#{tblComissao.dataAtuacaoTermino}"
               sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon"
               filterBy="#{tblComissao.dataAtuacaoTermino}" filterEvent="onkeyup"
               visible="false" title="Atuação da Comissão">
               <f:facet name="header">
               <h:outputText value="Término" />
               </f:facet>
               <h:outputText value="#{tblComissao.dataAtuacaoTermino}">
               <f:convertDateTime pattern="dd/MM/yyyy"/>
               </h:outputText>
               </rich:column>
               <rich:column id="chefeImediato" width="150" headerClass="dataTableHeader" label="ChefeImediato"
               sortable="true" sortBy="#{tblComissao.membrosComissao}" sortIconAscending="dataTableAscIcon"
               sortIconDescending="dataTableDescIcon">
               <f:facet name="header">
               <h:outputText value="Chefe Imediato" />
               </f:facet>
               <h:outputText value="#{tblComissao.membrosComissao}" />
               </rich:column>
               <rich:column id="servidoresAvaliaveis" width="150" headerClass="dataTableHeader"
               label="ServidoresAvaliaveis" sortable="true" sortBy="#{tblComissao.membrosComissao}"
               sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon">
               <f:facet name="header">
               <h:outputText value="Servidores Avaliáveis" />
               </f:facet>
               <h:outputText value="#{tblComissao.membrosComissao}" />
               </rich:column>
               <rich:column id="situacao" width="50" headerClass="dataTableHeader" label="ServidoresAvaliaveis"
               sortable="true" sortBy="#{tblComissao.situacao}"
               sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon">
               <f:facet name="header">
               <h:outputText value="Situação" />
               </f:facet>
               <h:outputText value="#{tblComissao.situacao}" />
               </rich:column>
               </rich:extendedDataTable>
               </h:panelGrid>
              


              My bean where I populate lstComissao

              public class ComissaoLst {
              
               private List<Comissao> lstComissao;
              
               public ComissaoLst() {
               // this method get all rows from JPA
               lstComissao = ComissaoBS.getInstancia().obterTodas();
               }
              
               public List<Comissao> getLstComissao() {
               System.out.println("Getting all rows...");
               lstComissao = ComissaoBS.getInstancia().obterTodas();
               return lstComissao;
               }
              
              }
              


              There are some rows at database, I don´t know why the faces component (extendedDataTable) don´t render these rows.

              Thank u.

              • 4. Re: How to popule a grid (rich:extendedDataTable)?
                Ilya Shaikovsky Master

                and the same code works with rich:dataTable?

                You may see our example at demosite. It uses simpel List also..