Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9016697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:04:01+00:00 2026-06-16T04:04:01+00:00

I am trying to implement lazyloading for Primefaces datatable. I have a filter condition

  • 0

I am trying to implement lazyloading for Primefaces datatable. I have a filter condition which I have implemented as

public List<Request> getRequest(int startingAt, int maxPerPage,
            String sortField, SortOrder sortOrder, Map<String, 
String> filters) {
        Criteria criteria = sessionFactory.getCurrentSession().
            createCriteria(Request.class);          
        for (Map.Entry<String, String> entry : filters.entrySet()) {            
            if(entry.getValue()!=null){             
                criteria.add(Restrictions.ilike("prNo",
                "%"+entry.getValue()+"%"));             
            }
        }
        criteria.setMaxResults(maxPerPage);
        criteria.setFirstResult(startingAt);
        return criteria.list();
    }

and in jsf page

<p:column id="prNo" filterBy="#{req.prNo}"   
                headerText="PR No">                 
                <h:outputText value="#{req.prNo}" />
            </p:column>

The issue I am facing is when filtered rows displays n datatable pagination numbers doesn’t change at all, it shows as of the actual number of records.
E.g. If filter matches a condition and number of rows for filter condition is 12, then pagination should display as 1 of 3 and pages should be like 1 2 3. See the attached screen shot.enter image description here

Lazymodel rowCount is set as

lazyModel.setRowCount(getRequestService().getRequestCount());

it’s implementation

int count = ((Long) sessionFactory.getCurrentSession()
                .createQuery("select count(*) from Request").uniqueResult())
                .intValue();

How could I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:04:02+00:00Added an answer on June 16, 2026 at 4:04 am

    INMO , you better use LazyDataModel (extend it just like in the showcase – DataTable – Lazy Loading)

    Inside your overridden load method you should do the filter logic and have the result , than get its size and use it…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement lazy loading within my primefaces datatable setup. Currently, this
I'm trying implement A* Start path finding in my games(which are written with JavaScript,
Im trying to implement a destructor for the objects of linked-list Iv created. I
Trying to implement what I thought was a simple concept. I have a user
Trying to implement a shell, mainly piping. I've written this test case which I
Im trying to implement some code i found on a website which duplicates a
Im trying to implement a voting system similar to stackoverflow and I have something
Trying to implement the following behavior on an iPad. I have a map-centric application
Trying to implement a timer for my game that I'm making. I have a
Trying to implement a simple print in SL4. I have a DataGrid that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.