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

不打扰是莪最后的温柔 提交于 2019-12-05 01:44:03

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/28541645/datatable-filter-and-clearfilters-hides-messages-pmessages-and-pgrowl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!