Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

My issue when I use:

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

or

<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="#{myMB.data}">
</p:dataTable>

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 autoUpdate="false" but I needed it so I don't want to set it to false.

like image 584
Al-Mothafar Avatar asked Feb 16 '15 12:02

Al-Mothafar


1 Answers

Solution is to add ajax filter event to the p:datatable:

<p:dataTable id="table" widgetVar="testTable" value="#{myMB.data}">
    <p:ajax event="filter" ignoreAutoUpdate="true" />
    {...}
</p:dataTable>
like image 87
Al-Mothafar Avatar answered Nov 01 '22 10:11

Al-Mothafar