Board index JavaServer Faces General LazyDataModel.load method is not called

LazyDataModel.load method is not called

Components, Ajax Framework, Utilities and More.

Posts: 10

In my case datatable component is used together with search form. Below you can find simplified version of the markup:

    <h:inputText value="#{controller.query.firstName}" />
    <h:inputText value="#{controller.query.lastName}" />

    <p:commandButton value="Search" actionListener="#{}" update="@form" />

    <p:dataTable value="#{controller.employees}" paginator="true" lazy="true">
    ... columns

LazyDataModel in the controller is implemented as anonymous class, class which is aware of #{controller.query} parameters:

public LazyDataModel<Employee> getEmployees() {
    return employees;

public void init() {
employees = new LazyDataModel<Employee>() {
    public List<Employee> load(int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters) {
   return employeeDao.findByQuery(query, first, pageSize); // query -> #{controller.query}

    public int getRowCount() {
   return employeeDao.countByQuery(query).intValue();

After search Ajax call only getRowCount is called. If the search query limits the result, the paginator is updated properly.
But load method is not called at all, and the datatable content is not updated.

I suppose that both methods should be called in consistent way.

JSF RI 2.0.3
PF 2.2.M1
Glassfish 3.0.1

Posts: 17240
Location: Cybertron

Does load method called when you do page or sort?

:shock: The forum can't be used in Chinese. :shock:
Solution See:[url][/url]

Return to General