I have PrimeFaces p:dataTable and lazy loading is enabled by implementing LazyDataModel .
Search results are stored in a DataTable, so when a search query is executed, the search service retrieves only the required (paginated) data. It works great.
When executing an ajax request with p:commandButton :
<p:commandButton id="searchCmdBtn" value="Search" action="#{searchBean.search}" update=":resultForm:resultList :filterForm:filterMenu :resultForm:messages" ajax="true" />
dataTable is updated correctly, but not filterMenu in filterForm (differnt forms, bcz using p:layout ).
The Menu filter is one request. This means that when I click the search button again, the Menu filter is updated when t is only updated after the second ajax request
Bean
@ManagedBean @ViewScoped public class SearchBean implements Serializable { private LazyDataModel<Entity> lazyDataModel; private MenuModel filterMenuModel = new DefaultMenuModel(); private SearchResult searchResult = null; public void search() {
filters.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:fn="http://java.sun.com/jsp/jstl/functions"> <p:panelMenu id="filterMenu" model="#{searchBean.filterMenuModel}" /> </ui:composition>
source share