API to get numbers from dataTables_info ?
API to get numbers from dataTables_info ?
louis1984
Posts: 2Questions: 1Answers: 0
Hi there,
I'm just starting to use this amazing library and I really enjoy it, so prior to all : thanks a lot, wonderful job !
My question is how to get the numbers from the small text displayed under the table that says for example :
"Showing 1 to 10 of 26 entries (filtered from 34 total entries)".
Is there a smart way to do it ?
Thanks !
Louis
This discussion has been closed.
Answers
by the way, the only numbers I want to get are :
- number of filtered entries
- total entries
thanks
You can retrieve those numbers using the
infoCallback
function, an example is below which outputs the values to the console. As you filter the table you'll see in the console the end number updates.http://datatables.net/reference/option/infoCallback
Hi Louis,
If you just want the numbers, you can use the DataTables API method
page.info()
to get that information. It returns an object whose properties describe the paging state of the table. You can use thepage
event, or theinfoCallback
that @anag mentions if you want to update your external controls whenever the paging information changes.Regards,
Allan