RecordsTotal, recordsFiltered information JQuery DataTable
I am reading the datatable doc but I cannot find the answer. My question is:
I have a table with 10.000 rows. I am doing a search by state and the result is 3000 lines. Out of 3000 lines, I'll show 20 per page.
"recordsTotal": what value should there be ?, "recordsFiltered": what value should there be ?,
If the recordTotal value should be 10.000, can I hide that value if I'm not interested?
source to share
From the official documentation :
recordsTotal
Total records before filtering (i.e. total number of records in the database)
recordsFiltered
Total records after filtering (i.e. the total number of records after filtering was applied - not just the number of records returned for this data page).
Your answer should be:
{
"draw": 1,
"recordsTotal": 10000,
"recordsFiltered": 3000,
"data": [
// ... skipped 20 records ...
]
}
I think that recordsTotal
is only used for the dashboard Showing 1 to 20 of 3000 entries (filtered from 10000 total entries)
. If you are not using a dashboard, you do not need to return a property recordsTotal
.
The property is recordsFiltered
also used by jQuery DataTables to calculate the number of pages required to render your dataset.
For more information, see Server-side - Returned Data .
source to share