how to exclude a row from total count of pagination or how to exclude a row from total count
how to exclude a row from total count of pagination or how to exclude a row from total count

Hi,
is there a way to ignore a row in total count pagination
let say I have 11 rows total but I don't want to include the first row into the total pagination
so I have 11 row but it should do count() minus 1 or if there is a way to exclude it from the total pagination count so the result will be total -1
let me know if this is not clear.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If it's there, it'll be counted. You could remove it with
row().remove()
Cheers,
Colin
Hi,
I need that row to be visible but not counted.
So I don't think row().remove() is the solution
is there a way to take the pagination count and do minus 1 so I will end with the correct total of row
If you are referring to the information element,
Showing 1 to 10 of 57 entries
for example, you would likely need to create your own. One way to do this would be to use thedom
option to remove it by removing thei
. Then use thedraw
event to display and update your own HTML element. You can get the page info using thepage.info()
API to update the element.Kevin
How could I modify the
"recordsTotal": 57,
value by doing -1so the result will be displayed as 56
Something like this to help you get started:
http://live.datatables.net/fajuwate/2/edit
You will need to add more logic to display things like
Showing 1 to 10 of 42 entries (filtered from 57 total entries)
when searching etc.You won't be able to directly subtract one from recordsTotal and have Datatables use that number.
Note also that I used the
dom
option to removei
but added my owndiv
to display the counts.Kevin
Not sure what you are doing with this one row but you could use
row().data()
to get the row data, append it to thethead
then remove it usingrow().remove()
as Colin suggested. This way you wouldn't need to mess with creating your own info display.Kevin
Thanks
You can get length data and add it into the language option.
Example:
var length_of_table = 123;
....DataTable({
language: {
"info": "Total: " + length_of_table
}
})