I am trying to search with filter in a entire table RowGroup (https://www.primefaces.org/showcase/ui/ ... roup.xhtml). Include each header instead only the content of every header.
Reproducing the table's example, I have created:
Where you can see, that if you use the searcer input at right-top, the results are filtering only the Green parts and not the Red ones.
The code I have created is:
XHTML:
Code: Select all
<p:dataTable var="car" value="#{grouperController.cars}" sortBy="#{car.brand}" expandableRowGroups="true" widgetVar="carsTable">
<f:facet name="header">
<p:inputText id="globalFilter" type="hidden" value="" immediate="true"
styleClass="real-global-filter">
<f:validateBean disabled="true"/>
</p:inputText>
</f:facet>
<p:headerRow>
<p:column colspan="3" filterBy="#{car.brand}">
<h:outputText value="#{car.brand}" />
</p:column>
</p:headerRow>
<p:column headerText="Year" filterBy="#{car.year}">
<h:outputText value="#{car.year}" />
</p:column>
<p:column headerText="Color" filterBy="#{car.color}">
<h:outputText value="#{car.color}" />
</p:column>
<p:column headerText="Id" filterBy="#{car.id}">
<h:outputText value="#{car.id}" />
</p:column>
<p:summaryRow>
<p:column colspan="2" style="text-align:right">
<h:outputText value="Total:" />
</p:column>
<p:column>
<h:outputText value="#{grouperController.randomPrice}">
<f:convertNumber type="currency" currencySymbol="$" />
</h:outputText>
</p:column>
</p:summaryRow>
</p:dataTable>
Code: Select all
function dtf_updateTableGlobalFilter(widgetVar,filterObj,realGFClass,auxGFClass) {
var newValue = jQuery(filterObj).val();
jQuery("."+realGFClass).val(newValue);
jQuery("."+auxGFClass).val(newValue);
PF(widgetVar).filter();
}
Ferran