I have a parent datatable that for each row has a child datatable accessible throw rowexpansion.
When I apply filters to the child table the filtered list is inherited by all the other child tables.
Same behaviour with sorting functionalities.
this is the code block:
Code: Select all
<p:dataTable id="tableData1" var="app" value="#{licenseMonitoringService.dataList}" widgetVar="applicationsDataTable"
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Applicazioni" />
</p:outputPanel>
</f:facet>
<p:column style="width:16px">
<p:rowToggler/>
</p:column>
<p:column headerText="ID" filterBy="#{app.applicationId}" filterMatchMode="exact" style="width:75px" filterStyle="width:75%">
<h:outputText value="#{app.applicationId}" />
</p:column>
<p:rowExpansion>
<p:dataTable id="subTab" var="appLib" value="#{app.libraryCollection}" widgetVar="subDataTable" style="width:100%">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Librerie contenute nell'applicazione" />
</p:outputPanel>
</f:facet>
<p:column headerText="ID libreria" style="width:75px">
<h:outputText value="#{appLib.libraryId}" />
</p:column>
<p:column headerText="Nome libreria" filterBy="#{appLib.libraryName}" filterMatchMode="contains" filterStyle="width:75%">
<h:outputText value="#{appLib.libraryName}" />
</p:column>
<p:column headerText="Versione libreria" style="width:150px;text-align:center" filterBy="#{appLib.libraryVersion}" filterMatchMode="contains" filterStyle="width:75%">
<h:outputText value="#{appLib.libraryVersion}" />
</p:column>
<p:column headerText="Policy Licenza" exportable="false" style="width:200px;;text-align:center" filterBy="#{appLib.licenseCollection[0].severityPolicy}" filterMatchMode="exact">
<f:facet name="filter">
<p:selectOneButton onchange="PF('subDataTable').filter()">
<f:selectItem itemLabel="*" itemValue="" />
<f:selectItem itemLabel="0" itemValue="0" />
<f:selectItem itemLabel="1" itemValue="1" />
<f:selectItem itemLabel="2" itemValue="2" />
<f:selectItem itemLabel="3" itemValue="3" />
</p:selectOneButton>
</f:facet>
<p:panelGrid columns="2" rendered="#{not empty appLib.licenseCollection}">
<p:row>
<p:column style="width:50px" exportable="false">
<h:graphicImage library="images" name="blu.jpg" rendered="#{appLib.licenseCollection[0].severityPolicy == 0}" />
<h:graphicImage library="images" name="green.jpg" rendered="#{appLib.licenseCollection[0].severityPolicy == 1}" />
<h:graphicImage library="images" name="yellow.jpg" rendered="#{appLib.licenseCollection[0].severityPolicy == 2}" />
<h:graphicImage library="images" name="red.jpg" rendered="#{appLib.licenseCollection[0].severityPolicy == 3}" />
</p:column>
</p:row>
</p:panelGrid>
</p:column>
<p:column headerText="Security Issue" style="width:150px;text-align:center" filterBy="#{appLib.securityissueCollection}" filterFunction="#{licenseMonitoringService.filterByWarning}" filterStyle="width:100px" exportable="false">
<f:facet name="filter">
<p:selectOneButton onchange="PF('subDataTable').filter()">
<f:selectItem itemLabel="*" itemValue="" />
<f:selectItem itemLabel="SI" itemValue="true" />
<f:selectItem itemLabel="NO" itemValue="false" />
</p:selectOneButton>
</f:facet>
<h:graphicImage library="images" name="warning.png" rendered="#{not empty appLib.securityissueCollection}" />
</p:column>
<p:column headerText="Security Issue" style="width:0px;text-align:center" filterBy="#{appLib.securityissueCollection}" filterFunction="#{licenseMonitoringService.filterByWarning}" filterStyle="width:0px" exportable="true" >
<h:outputText value="TRUE" rendered="#{not empty appLib.securityissueCollection}"/>
</p:column>
<p:column headerText="Dettagli" style="width:100px" exportable="false">
<p:commandButton value="Visualizza" icon="ui-icon-search" oncomplete="PF('licensesDialog').show()" update="form:viewLicenses" action="#{licenseMonitoringService.queryDbForAssociatedLicenses(appLib.libraryId)}" />
</p:column>
</p:dataTable>
</p:rowExpansion>
</p:dataTable>