4 Replies Latest reply on Feb 23, 2012 2:02 PM by Maheswara Sunkara

    Help needed with nested datatable / filter

    Sebastien Morissette Newbie

      Hi,

       

      i'm brand new to using richfaces and i have a question on nested tables,

       

      i've implemented the nested table and added a filter to it, it works fine however, when the 2nd table is filtered and the list that feeds it becomes empty because of the filter criteria, i would like to not show that row.

       

      example code :

       

      <h:form>
         <rich:dataTable id="listState1" value="#{statesBean.listState}"
          var="varlistState" style="width: 100%;border-width: 0px"  >
          <f:facet name="header">
           <rich:columnGroup>
           
            <rich:column  >
             <h:outputText value="Project Filter : " />
                   <h:inputText value="#{statesBean.projectFilter}">
              <a4j:ajax event="blur" render="listState1" execute="@this" />
             </h:inputText>

            </rich:column>
           
           </rich:columnGroup>
          </f:facet>
          <rich:column id="node1column" style="border-width: 0px" >

          
           <rich:dataTable id="statesList1" value="#{varlistState.statesList}"   

          var="varstatesList" style="width: 100%" rowClasses="odd-row, even-row">
            <f:facet name="header">
           <rich:columnGroup>
            <rich:column rowspan="2" style="width: 150px">
            <h:outputText value="#{varlistState.node}" style="font-size: 14pt;"/>

            </rich:column>
            <rich:column colspan="2" style="width: 125px">
             <h:outputText value="Application Versions" />
            </rich:column>
            <rich:column colspan="2" style="width: 125px">
             <h:outputText value="Properties Versions" />
            </rich:column>
            <rich:column rowspan="2">
             <h:outputText value="State" />
            </rich:column>
             <rich:column rowspan="2">
             <h:outputText value="History" />
            </rich:column>
            <rich:column breakRowBefore="true" style="width: 50px">
             <h:outputText value="Previous" />
            </rich:column>
            <rich:column style="width: 50px">
             <h:outputText value="Current" />
            </rich:column>
            <rich:column style="width: 50px">
             <h:outputText value="Previous" />
            </rich:column>
            <rich:column style="width: 50px">
             <h:outputText value="Current" />
            </rich:column>
           </rich:columnGroup>
          </f:facet>
             <rich:column id="name1column" filterValue="#{statesBean.projectFilter}" filterExpression="#{fn:containsIgnoreCase(varstatesList.name, statesBean.projectFilter)}">
                
                   <h:outputText styleClass="outputText" id="name1"
              value="#{varstatesList.name}">
             </h:outputText>
            </rich:column>
            <rich:column id="prevVersion1column">
            
             <h:outputText styleClass="outputText" id="prevVersion1"
              value="#{varstatesList.prevVersion}">
             </h:outputText>
            </rich:column>
            <rich:column id="currVersion1column">
            
             <h:outputText styleClass="outputText" id="currVersion1"
              value="#{varstatesList.currVersion}">
             </h:outputText>
            </rich:column>
            <rich:column id="prevVersionProps1column">
            
             <h:outputText styleClass="outputText" id="prevVersionProps1"
              value="#{varstatesList.prevVersionProps}">
             </h:outputText>
            </rich:column>
            <rich:column id="currVersionProps1column">
            
             <h:outputText styleClass="outputText" id="currVersionProps1"
              value="#{varstatesList.currVersionProps}">
             </h:outputText>
            </rich:column>
            <rich:column id="currState1column">
            
             <h:selectOneMenu styleClass="selectOneMenu" id="currState1"
              value="#{varstatesList.currState}">
              <f:selectItem itemLabel="Redeployable" itemValue="Redeployable" />
              <f:selectItem itemLabel="#{statesBean.envName}"
                value="#{statesBean.envName}"/>
             </h:selectOneMenu>
            </rich:column>
            <rich:column id="projId1column">
            
             <h:outputText styleClass="outputText" id="projId1"
              value="#{varstatesList.projId}">
             </h:outputText>
            </rich:column>
           </rich:dataTable>
          </rich:column>
         </rich:dataTable>


        </h:form>