How can I capture the event filtering a p:dataTable
in PrimeFaces. I need to calculate some values associated with the results list when filtered and I have to do the calculations using the filtering table:
<p:dataTable id="tabla_gral" rendered="#{consumoMaterial.verTabla}" var="item"
paginator="true" rows="15" rowKey="#{item.no}"
value="#{consumoMaterial.listadoConsumo}"
filteredValue="#{consumoMaterial.listadoConsumoFiltered}">
But I want to do the calculation every time you use the filtrate.
Primefaces p:dataTable
has AJAX event filter
which you can define on p:dataTable
:
<p:dataTable>
<p:ajax event="filter" listener="#{myBean.filterListener}"/>
</p:dataTable>
Now in your backing bean define method filterListener
:
public void filterListener(FilterEvent filterEvent) {
// your code here...
}
Now, your filterListener
function will be called on every filter event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With