title: JS lib: Datatables. Pagination not working right in server side call
body: <p>This is a total shot in the dark before I go diving into Datatables source code.</p>
  
  <p>So, I've implemented a JSON service to back Datatables. The problem is, I can paginate further than there is actual data.</p>
  
  <p>The only thing I can find around the subject that might affect pagination is returning it recordsTotal in the json:
  <a href="https://datatables.net/manual/server-side#Returned-data" rel="nofollow">https://datatables.net/manual/server-side#Returned-data</a></p>
  
  <p>All my services are returning accurate record counts, yet I can still paginate past where there is actual data. Anybody by chance happen to have a clue what's going on? For the record the JSON response is something to the effect of:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{
    "recordsTotal": 8023,
    "data": [
      [
        8001,
        "W078292",
        "SHARPCUT REGRIND DIV",
        "",
        "",
        "Non-Core",
        2,
        "$               15.00"
      ],
      [
        8002,
        "W5041016",
        "RPR: MILWAUK  2602-2",
        "",
        "",
        "Non-Core",
        1,
        "$              164.80"
      ],
      [
        8003,
        "W5042707",
        "RPR: HARRINGT ??",
        "",
        "",
        "Non-Core",
        1,
        "$              249.65"
      ],
      [
        8004,
        "W5043247",
        "RPR: FASCO    11081F",
        "",
        "",
        "Non-Core",
        1,
        "$               80.42"
      ],
      [
        8005,
        "W5043921",
        "CALIBRATION",
        "",
        "",
        "Non-Core",
        1,
        "$               62.51"
      ],
      [
        8006,
        "W5044744",
        "RPR: DEWALT   DC900",
        "",
        "",
        "Non-Core",
        1,
        "$               16.00"
      ],
      [
        8007,
        "W5044758",
        "RPR: DEWALT   DC305",
        "",
        "",
        "Non-Core",
        1,
        "$              141.38"
      ],
      [
        8008,
        "W5044760",
        "RPR: MILWAUKE 6517-2",
        "",
        "",
        "Non-Core",
        1,
        "$               72.50"
      ],
      [
        8009,
        "W5045318",
        "RPR: MILWAUKE 2652-2",
        "",
        "",
        "Non-Core",
        1,
        "$               95.65"
      ],
      [
        8010,
        "W5047329",
        "RPR: METABO   WP8-11",
        "",
        "",
        "Non-Core",
        1,
        "$               44.70"
      ],
      [
        8011,
        "W5049657",
        "RPR: IR       259",
        "",
        "",
        "Non-Core",
        2,
        "$              620.48"
      ],
      [
        8012,
        "W5049658",
        "RPR: IR       2145QI",
        "",
        "",
        "Non-Core",
        2,
        "$              539.44"
      ],
      [
        8013,
        "W5049659",
        "RPR: IR       2145QI",
        "",
        "",
        "Non-Core",
        2,
        "$              539.44"
      ],
      [
        8014,
        "W5050385",
        "RPR: DEWALT   DWE402",
        "",
        "",
        "Non-Core",
        1,
        "$               49.99"
      ],
      [
        8015,
        "W5050386",
        "RPR: DEWALT   DWE402",
        "",
        "",
        "Non-Core",
        1,
        "$               49.99"
      ],
      [
        8016,
        "W5051607",
        "CARGILL INSPECTION",
        "",
        "",
        "Non-Core",
        1,
        "$            5,000.00"
      ],
      [
        8017,
        "W5053076",
        "RPR: DEWALT   ?",
        "",
        "",
        "Non-Core",
        1,
        "$               25.00"
      ],
      [
        8018,
        "WE6340000A20000",
        "M4  EXT TOOTH L\/W A2",
        "01-Fasteners",
        "05-Washers",
        "Non-Core",
        800,
        "$               11.12"
      ],
      [
        8019,
        "XM2540008A20000",
        "M5 X 8 PH FHMS A-2",
        "01-Fasteners",
        "03-Screws",
        "Non-Core",
        150,
        "$                5.00"
      ],
      [
        8020,
        "XM2540020A20000",
        "M5 X 20 PH FHMS A-2",
        "01-Fasteners",
        "03-Screws",
        "Core",
        50,
        "$                2.00"
      ],
      [
        8021,
        "XM2540025A20000",
        "M5 X 25 PH FHMS A-2",
        "01-Fasteners",
        "03-Screws",
        "Core",
        50,
        "$                3.00"
      ],
      [
        8022,
        "XM2540030A20000",
        "M5 X 30 PH FHMS A-2",
        "01-Fasteners",
        "03-Screws",
        "Core",
        50,
        "$                5.00"
      ],
      [
        8023,
        "XM2550016A20000",
        "M6 X 16 PH FHMS A-2",
        "01-Fasteners",
        "03-Screws",
        "Core",
        50,
        "$                3.10"
      ]
    ]
  }</code></pre>
  </div>
  </div>
  </p>