JQuery DataTables .Net Server Side Pagination Issues

百般思念 提交于 2019-11-29 01:20:58

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!