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

The Archive Base Latest Questions

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

I’m using jqGrid in an ASP.NET MVC webapp. When the page first loads, the

  • 0

I’m using jqGrid in an ASP.NET MVC webapp. When the page first loads, the pager buttons are disabled and always show Page 1 of 1. However, if I change the page size, sort a column or perform a search, the pages update appropriately.

I’ve tried triggering reloadGrid in both gridComplete and loadComplete but neither are doing the trick. What is being called when I perform the other actions that gets the paging to refresh?

Here is my grid:

$(document).ready(function () {
    $('#grid').jqGrid({
        url: '@Url.Action("GetGridData", "MyController")',
        datatype: 'json',
        loadonce: true,
        mtype: 'POST',
        postData: {},
        colNames: ['Name', 'Price', 'Inventory'],
        colModel: [
            { name: 'Name', index: 'Name' },
            { name: 'Price', index: 'Price', sorttype: 'float', formatter: 'number', align: 'right' },
            { name: 'Inv', index: 'Inv', sorttype: 'int', align: 'right' }
        ],
        pager: '#gridpager',
        rowNum: 10,
        rowList: [5, 10, 20, 50, 100],
        sortname: 'Name',
        sortorder: 'asc',
        viewrecords: true,
        caption: 'Inventory',
        hidegrid: false,
        forceFit: true,
        height: 'auto',
        width: 1200
        //loadComplete: function() {     
        //    $('#grid').trigger("reloadGrid");
        //},
        //gridComplete: function () {
        //    $('#grid').trigger("reloadGrid");
        //}
    }).jqGrid('filterToolbar', { searchOnEnter: false }).jqGrid('navGrid', '#gridpager', { del: false, add: false, edit: false, search: false });

Server code:

[HttpPost]
public JsonResult GetGridData(string sidx, string sord, int page, int rows)
{
    List<Inventory> data = InventoryModel.GetInventory();

    var count = data.Count;

    var jsonData = new
        {
            total = (int)Math.Ceiling((double)count / rows),
            page = 1,
            records = count,
            rows = (from row in data
                    select new
                    {
                        id = row.Name,
                        cell = new object[]
                            {
                                row.Name,
                                row.Price,
                                row.Inv                         
                            }
                    }).ToArray()
        };
    return Json(jsonData);
}

JSON data:

{
  "total":11,
  "page":1,
  "records":104,
  "rows": [ { "id":"PRODUCT-1", "cell":["PRODUCT-1",0.52,41] },
            { "id":"PRODUCT-2", "cell":["PRODUCT-2",0.43,50] },
          ... ]
}
  • 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-28T18:36:22+00:00Added an answer on May 28, 2026 at 6:36 pm

    I am almost sure that the reason is the wrong JSON data which return the server. I suppose that the server returns total equal to 1 independent from the rowNum which will be send to the server as the rows parameter. It’s important to understand that the grid body will be have the first rowNum (10) rows in the same order like from the server response. Because you use loadonce: true then the next refreshing of grid work locally and so it works correct. In any way the server should fill correct total parameter and it should use provide the data sorted corresponds to sortname and sortorder option of jqGrid. The parameters will be sent to the server as sidx and sord.

    UPDATED: The reason if the bug in jqGrid 4.3.1

    the line

    ts.p.lastpage = Math.min( ts.p.page, Math.ceil(len/ rn) );
    

    should be fixed to

    ts.p.lastpage = Math.ceil(len/ rn);
    

    For more information see my bug report here and the fix in the version of jqGrid on github here

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.