Format Pagination Info Display
Format Pagination Info Display
jakotheshadows
Posts: 2Questions: 0Answers: 0
I'm using server side processing, and one of the DB tables I'm pulling data from is very large, making counts slow. To that end, I use a "scaling" count where I just count the first displayed record plus try to count the next 1000 in the database since the table may range from very small to very large.
What I'd like to do with datatables is reformat the "Showing x through y of z entries" (without changing datatables code as this is a special case in a larger web app) and display instead "Showing x through y of at least z entries" instead. Where can I get the x, y, and z I need to rewrite the text in that element?
What I'd like to do with datatables is reformat the "Showing x through y of z entries" (without changing datatables code as this is a special case in a larger web app) and display instead "Showing x through y of at least z entries" instead. Where can I get the x, y, and z I need to rewrite the text in that element?
This discussion has been closed.
Replies
$('#' + YOUR_DATATABLES_TABLE_ID + '_info').text('WHATEVER TEXT FOR THE PAGE INFO');
Allan
(where myTable is the variable I assigned my Datatables instance to)
iDisplayStart: [code]myTable.fnSettings()._iDisplayStart[/code]
iDisplayLength: [code]myTable.fnSettings()._iDisplayLength[/code]
So, for example if I want to change the info string to omit the "total" I can do:
[code]
$('#' + tableID + '_info').text('Showing Entries ' +
(myTable.fnSettings()._iDisplayStart + 1)
+ ' to ' +
(myTable.fnSettings()._iDisplayStart +
myTable.fnSettings()._iDisplayLength));
[/code]
I imagine iTotalRecords and iTotalDisplayRecords can be accessed in a similar fashion for omission or modification.
DataTables 1.10 has a similar function built in ( `page.info()` ).
Allan