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

  • SEARCH
  • Home
  • 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 8365529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:40:59+00:00 2026-06-09T12:40:59+00:00

I am using lazy loading ,paging and global filter in the dataTable In the

  • 0

I am using lazy loading ,paging and global filter in the dataTable

In the lazy load function I add 2 function in order to support 2 scenarios:

1) When the user is paging

2) When the user add a value in the global filter and press “Enter”

Basically what I need to know is what activity was execute in order to decide what function to use.

dataTable:

     <p:dataTable id="osTable"       
                     var="object"
                     value="#{bean.lazyModel}"
                     selection="#{bean.selectedObjectSet}"
                     selectionMode="single"
                     rowKey="#{object.ID}"
                     paginator="true"
                     paginatorPosition="bottom"
                     paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                     rowsPerPageTemplate="5,10,15"
                     rows="10"
                     widgetVar="objectTable">
            <f:facet name="header"> 
                <p:outputPanel style="float: right"> 
                    <h:outputText value="Search all fields:" /> 
                    <p:inputText id="globalFilter" 
                                 onkeypress="if (event.keyCode == 13) {objectSetTable.filter()}"
                                 style="width:150px"/>
                </p:outputPanel> 
            </f:facet>

load function:

  @Override
public List<CfgSe2deMapping> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
    List<Mapping> data = new ArrayList<Mapping>();


    if (// if user press enter ) {
        data.addAll(MappingHelper.getViaFilter(filters.get("globalFilter")));
    } else {
        data.addAll(MappingHelper.getViaOffSet(first + 1, first + pageSize));
    }

I am using primefaces 3.2

Thanks

  • 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-09T12:41:00+00:00Added an answer on June 9, 2026 at 12:41 pm

    you are thinking this the wrong way. no matter what the user did, you should always do the same: retrieve data (applying filters, if any) and paginate (return pageSize rows starting from first.

    why aren’t you including the ‘first’ and ‘pageSize’ parameters when there’s a filter? rows have to be paginated either way. otherwise the user would be able to see only the first page of filtered results.

    Also, you have to override getRowCount method, so that your table shows the right number of pages.

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

Sidebar

Related Questions

I'm using Mika Tuupola's Lazy Load plugin http://www.appelsiini.net/projects/lazyload to delay loading images as you
I'm using Lazy Loading List in my application and I need to load only
I am using lazy load jquery plugin . It tells me to put this
We're using an asp:TreeView configured with lazy loading. The callback method assigned for OnTreeNodePopulate
I was wondering if using require() in node.js was the equivalent to lazy loading?
I am using NHibernate 2.0.1 and .NET I am facing issues with Lazy loading
I'm using NHibernate to administer my entities, and to have lazy loading enabled I
I'm building a web application and using lazy-loading as default. I would like the
I have a project by NHibernate implementation and using Lazy Loading. I have two
I'm trying to learn Spring+Hibernate and I started using Lazy loading with Hibernate. To

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.