Pagination totals and bServerSide
Pagination totals and bServerSide
Using sAjaxSource and bServerSide settings I paginate through a large dataset and only send a 25 rows back at a time to the client. Is there a built-in way to pass back the totals for the entire dataset? I'm aware of the fnFooterCallback function, but it appears to only supply the rows that are available client side.
Currently I'm thinking that I could pass the totals as the last row and just modify the datatable.js file to ignore the last row and then in the fnFooterCallback that is the row that I would look at to obtain the totals.
Is there a recommended way to handle this situation?
Thanks.
Currently I'm thinking that I could pass the totals as the last row and just modify the datatable.js file to ignore the last row and then in the fnFooterCallback that is the row that I would look at to obtain the totals.
Is there a recommended way to handle this situation?
Thanks.
This discussion has been closed.
Replies
From http://datatables.net/forums/comments.php?DiscussionID=53 this is the set of variables that DataTables will send to the server, and the ones it expects back:
DataTables tells you what it needs through the following "get" variables:
iDisplayStart - Display start point
iDisplayLength - Number of records to display
sSearch - Global search field
bEscapeRegex - Global search is regex or not (you probably don't want to enable this on the client-side!)
iColumns - Number of columns being displayed (useful for getting individual column search info)
sSearch_(int) - Individual column filter
bEscapeRegex_(int) - Individual column filter is regex or not
iSortingCols - Number of columns to sort on
iSortCol_(int) - Column being sorted on (you will need to decode this number for your database)
iSortDir_(int) - Direction to be sorted
sColumns - column names - optional
DataTables expects to receive a JSON object with this following properties:
iTotalRecords - Total records, after filtering (not just the records on this page, all of them)
iTotalDisplayRecords - Total records, before filtering
aaData - The data in a 2D array
sColumns - column names - optional
So iTotalRecords and iTotalDisplayRecords are the ones you want I think.
Allan