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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:28:11+00:00 2026-05-21T18:28:11+00:00

Does anyone know of a way to set up jqGrid to use a numeric

  • 0

Does anyone know of a way to set up jqGrid to use a numeric pager?

Instead of Page 1 of 20, I want to have the paging be like 1,2,3,4 > >> and when I click on 4 it would something like << < 4,5,6,7 > >>

I’ve seen how other grids do it, but I can’t seem to find a built in way for jqGrid to do it.
I may have a way to implement it, but I don’t want to reinvent the wheel if there is something already out there. It would involve me adding custom buttons after getting userdata from the grid’s data to determine the pages available.

Telerik’s grid does it (http://demos.telerik.com/aspnet-mvc/grid).

  • 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-21T18:28:12+00:00Added an answer on May 21, 2026 at 6:28 pm

    Ohhh! During I wrote the code firegnom posted another implementation. Nevertheless better two working versions as no one.

    I made small demo which demonstrate how the behavior with links in the pager can be implemented. I made the code so, that it can display the pager either in the form

    enter image description here

    (if pginput: false parameter of jqGrid are used) or in the form

    enter image description here

    In both cases the current page will not displayed in the list. How one can see I inserted the underlined style for the links. If you don’t like it you should remove

    td.myPager a { text-decoration:underline !important }
    

    from the demo. The working live demos you can see here and here.

    The corresponding JavaScript code is full inside of loadComplete event handler:

    loadComplete: function() {
        var i, myPageRefresh = function(e) {
            var newPage = $(e.target).text();
            grid.trigger("reloadGrid",[{page:newPage}]);
            e.preventDefault();
        };
    
        $(grid[0].p.pager + '_center td.myPager').remove();
        var pagerPrevTD = $('<td>', { class: "myPager"}), prevPagesIncluded = 0,
            pagerNextTD = $('<td>', { class: "myPager"}), nextPagesIncluded = 0,
            totalStyle = grid[0].p.pginput === false,
            startIndex = totalStyle? this.p.page-MAX_PAGERS*2: this.p.page-MAX_PAGERS;
        for (i=startIndex; i<=this.p.lastpage && (totalStyle? (prevPagesIncluded+nextPagesIncluded<MAX_PAGERS*2):(nextPagesIncluded<MAX_PAGERS)); i++) {
            if (i<=0 || i === this.p.page) { continue; }
    
            var link = $('<a>', { href:'#', click:myPageRefresh });
            link.text(String(i));
            if (i<this.p.page || totalStyle) {
                if (prevPagesIncluded>0) { pagerPrevTD.append('<span>,&nbsp;</span>'); }
                pagerPrevTD.append(link);
                prevPagesIncluded++;
            } else {
                if (nextPagesIncluded>0 || (totalStyle && prevPagesIncluded>0)) { pagerNextTD.append('<span>,&nbsp;</span>'); }
                pagerNextTD.append(link);
                nextPagesIncluded++;
            }
        }
        if (prevPagesIncluded > 0) {
            $(grid[0].p.pager + '_center td[id^="prev"]').after(pagerPrevTD);
        }
        if (nextPagesIncluded > 0) {
            $(grid[0].p.pager + '_center td[id^="next"]').before(pagerNextTD);
        }
    }
    

    where grid and MAX_PAGERS are defined as

    var grid = $("#list"), MAX_PAGERS = 2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By default nunit tests run alphabetically. Does anyone know of any way to set
Does anyone know of a simple way to set a selected index or item
does anyone know a way how I could set through mapping the default value
Does anyone know a way to detect the older set of devices: iPod touch
Does anyone know the best way to set the background of a row or
Does anyone know a way to set the style of a ToggleButton within a
Does anyone know of a way to set a specific classpath order in Maven2,
Does anyone know a way that I can set my picker to default /
Does anyone know of an easy way to set the niceness value of a
Does anyone know of a way to set a proxy on httpclient that comes

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.