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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:13:47+00:00 2026-05-26T00:13:47+00:00

I’m working on a bug fix right now for an application at work where

  • 0

I’m working on a bug fix right now for an application at work where the prior developer (since gone) didn’t bother to paginate the data results on a page meant specifically for listing out data results.

This of course has reared it’s ugly head as users are starting to see long running script errors in IE. This, combined with the sheer data volume size, is making web pages nearly useless.

Fast forward to my attempts to fix it and they’ve gone pretty well. The site is a .NET MVC 2 site that was developed using DataTables to add search/sort/paging functionality on the client. I’d just completed a similar task using jqGrid so figured this would be relatively straight forward. And it has been except one small problem. I cannot for the life of me get page links to generate.

A quick results view:

The results know that there are 2086 records in this query:

enter image description here

But paging links are not generated.

enter image description here

My action method is returning JSON via

return Json(new
              {
                 param.sEcho,
                 iTotalRecords = totalRecords,
                 iTotalDisplayRecords = filteredContracts.Count(),
                 aaData = result
              },
           JsonRequestBehavior.AllowGet);

where

param.sEcho = “1”,
iTotalRecords = 2086,
iTotalDisplayRecords = 25,
and aaData is the array result of data to display

To be thorough, he’s the datatable initialize statement:

    $("#tblToDoItems").dataTable({
        'bServerSide': true,
        'bProcessing': true,
        'sAjaxSource': '/Home/GetContractList',
        "bJQueryUI": true,
        "bAutoWidth": false,
        "bPaginate": true,
        "sPaginationType": "full_numbers",
        "iDisplayLength": 25,
    /* make the first and last columns not sortable */
        "aoColumnDefs": [
            { "bSortable": false, "aTargets": [0, -1] }
        ]
    });

Am I missing some setting that would prevent DataTables from properly generating pagination via server side data retrieval?

  • 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-26T00:13:48+00:00Added an answer on May 26, 2026 at 12:13 am

    Your iTotalDisplayRecords is equal to 25, so datatables think that there are only 25 contracts on the server side and second page is not needed because all of them are already shown on the current page.
    This is comon mistake – if you take a look at the JQuery MVC tutorial section Implementation of server-side paging you will see that there are three numbers:

    1. iTotalRecords = allCompanies.Count() representing all entries in the database (in your case 2086)
    2. iTotalDisplayRecords = filteredCompanies.Count() representing the number of the records that match the current search condition. If you didn’t used filtering this number should be same as the iTotalRecords 2086, but in yourcase it is 25.
    3. result.Count – this is 25. This number is not passed in the JSON response because DataTables already knows that there should be 25 records per page.

    If you put all.Count insteadof the result.Count into the iTotalDisplayRecords DataTables will show paging. iTotalDisplayRecords and iTotalRecords are used to show message
    “Showing 1 to 25 of iTotalDisplayRecords (iTotalRecords in total)”

    If iTotalDisplayRecords is equal to 25, DataTables will show message “Showing 1 to 25 of 25 (iTotalRecords in total)”, and assume that there is no page 2; hence, paging will be disabled, as in your example.

    Jovan

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.