LazyDataModel.load method is not called

Components, Ajax Framework, Utilities and More.
Post Reply
Posts: 10
Joined: 25 Jun 2010, 10:54

10 Sep 2010, 12:26


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

Code: Select all

    <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:

Code: Select all

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

User avatar
Posts: 17556
Joined: 05 Jan 2009, 00:21
Location: Cybertron

16 Sep 2010, 20:20

Does load method called when you do page or sort?
Posts: 1
Joined: 23 Oct 2010, 12:42

23 Oct 2010, 12:59

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

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 14 guests