JQuery DataTables .Net Server Side Pagination Issues JQuery DataTables .Net Server Side Pagination Issues jquery jquery

JQuery DataTables .Net Server Side Pagination Issues


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