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 7623643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:45:29+00:00 2026-05-31T04:45:29+00:00

I am using ExtJS 3.3.1 with Grails 2.0 to do pagination on screen, but

  • 0

I am using ExtJS 3.3.1 with Grails 2.0 to do pagination on screen, but it does not work as I expect.
I followed the tip posted here: Grails extJS grid paging
JS page

paramNames: {start:'offset',limit:'max',sort:'sort',dir:'order'},
baseParams: {offset:0,max:10},

The pagingToolbar:

this.gridBBar = new Ext.PagingToolbar({
            pageSize : 10,
            store : this.gridStore,
            displayInfo : true,
            displayMsg  : 'Hiển thị {0} - {1} mục tìm được của {2} kết quả',
            emptyMsg : 'Không tìm thấy dữ liệu',
        });

Controller:

def result = Floor.createCriteria().list(
   max:params.int('max')?:100, 
   offset:params.int('offset')?:0
) 
render ([count:result.totalCount,data:result] as JSON)

but the paging button (Next) was disabled because the store just contained only 10 item, no more to retrieve.
When I change the offset to 10:

paramNames: {start:'offset',limit:'max',sort:'sort',dir:'order'},
baseParams: {offset:10,max:10},

the pagination is work well, except one strange thing: the grid always display the next 10 results (10th-20th record for 1st click, 20th-30th record for 2nd), not the current first 10 results. I don’t know what the correct usage of pagination combined from ExtJs and Grails is. If you have experience in this problem, could you please share me some information?
Thank you so much.

  • 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-05-31T04:45:30+00:00Added an answer on May 31, 2026 at 4:45 am

    Oh how lucky I am. I’ve got it!
    Based on these 2 articles:
    1. http://grails.1312388.n4.nabble.com/Find-Count-for-pagination-And-Objects-for-Criteria-td1368528.html
    and
    2. http://blog.jeffshurts.com/2010/04/grails-pagination-and-criteriabuilder/
    I have found the explanation for this. Because the “count” property returned in JSON is got from result.size(), so it always equals to the pageSize of PagingToolbar of the grid’s store, so the store will understand that, there is no more any result to retrieve and it will disable the navigation buttons.
    The key here is returning the real total result of the query (without attaching pagination constraints). As normal, the createCriteria().list {} will return an ArraysList. But by passing paging params to list as below: (refer to link 1)

    DomainClass.createCriteria().list(max : x, offset : y) { 
    // not pass max : x, offset : y to here, inside the body
    }
    

    Grails will return the result as a PagedResultList implicitly (refer to link 2), and it provide us the getTotalCount(). There’s no any official documentation of Grails mention this magical issue.
    And my problem was solved.

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

Sidebar

Related Questions

I'm trying to make data grid with paging using ExtJs framework, but unfortunately my
I've been looking at using ExtJS Direct with ASP.NET MVC but it doesn't seem
I am using ExtJS 3 here. I would like to populate a formpanel from
I created a grid using extjs library. First created a model: Ext.define('Option', { extend:
I am using extjs grid, and I have a jQuery timer, which will call
im using extjs 4.0 and am trying to combine an editable grid with a
I'm using ExtJs 3.2.2. I wrote a custom context menu to handle a grid's
i was using extjs for an application but when i verified some of the
I'm new in using Extjs Library , I want to use GridPanel but I
I am working on my first project using ExtJS. I have a Data Grid

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.