1

PrimeFaces 8.0

<p:dataTable value="#{MyView.parents}" var="parent" id="parentID" widgetVar="parentsVar">
   <p:column headerText="Column 1" sortable="true" sortBy="#{parent.name}" filterable="true" filterBy="#{parent.name}" filterMatchMode="contains" filterFunction="#{FilterController.filterByString}">
      <f:facet name="filter">
         <p:selectCheckboxMenu label=""
            onchange="PF('parentsVar').filter()" updateLabel="true">
            <f:selectItems value="#{MyView.namesForFilter}" />
         </p:selectCheckboxMenu>
      </f:facet>
      <h:outputText value="#{parent.name}"/>
   </p:column>
   <p:column >
      <p:rowToggler >
      </p:rowToggler>
   </p:column>
   <p:rowExpansion>
      <p:dataTable value="#{parent.children}" var="child" id="childID" widgetVar="childVar">
         <p:column headerText="Child Type" filterable="true" filterBy="#{child.type}"
            filterMatchMode="contains" filterFunction="#{FilterController.filterByString}">
            <f:facet name="filter">
               <p:selectCheckboxMenu label=""
                  onchange="PF('childVar').filter()">
                  <f:selectItems value="#{utilityPSA.childTypesForFilter}" />
               </p:selectCheckboxMenu>
            </f:facet>
            <h:outputText value="#{child.type}"/>
         </p:column>
      </p:dataTable>
   </p:rowExpansion>
</p:dataTable>

Two issues:

  1. Filtering is not working when I have two rowexpansion columns expanded
  2. Filtering on a child table in a row expansion is replacing all the other row expansions with same filtered child record even though the child data doesn't belong to the row expansion.

Any help appreciated. Thanks for your time.

Melloware
  • 10,435
  • 2
  • 32
  • 62
gvg
  • 31
  • 3
  • You didn't mention your version of PrimeFaces. – Melloware May 22 '21 at 11:21
  • I am using Primefaces version 8.0. Thanks! – gvg May 22 '21 at 15:11
  • I typically don't like th UI paradigm of a filterable datatable inside an expansion of another datatable with filtering. Don't use Row Expansion but have the user click on a row and open an panel at the bottom of the screen with your new datatable in it. The problem you are running into is all the nested datatables. – Melloware May 22 '21 at 16:27
  • It happens the same in Primefaces 11.0 – Xavi Torrens Dec 16 '22 at 13:15

0 Answers0