Al-Mothafar Al-Mothafar - 1 year ago 445
Ajax Question

DataTable .filter() and clearFilters() hides messages p:messages and p:growl

My issue when I use:

<p:growl id="growl" autoUpdate="true" />


<p:messages id="messages" autoUpdate="true" />

When I have error message, and once I use clear filters or re filter for primefaces datatable like :

<p:commandButton value="do somthing and re-filter" oncomplete="PF('testTable').filter()"/>

<p:commandButton value="do somthing and clear filter" oncomplete="PF('testTable').clearFilters()"/>

<p:dataTable id="table" widgetVar="testTable" value="#{}">

The messages got hidden, that because the autoUpdate is true, so ajax call for filter fired and return with no messages so this call clear messages, will be a solution if I make
but I needed it so I don't want to set it to false.

Answer Source

Solution is add ajax filter event to datatable:

<p:dataTable id="table" widgetVar="testTable" value="#{}">
    <p:ajax event="filter" ignoreAutoUpdate="true" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download