How can I display the number of rows displayed, both sorted and not sorted
How can I display the number of rows displayed, both sorted and not sorted
magmo
Posts: 6Questions: 3Answers: 0
I wonder if its possible to display the number of rows displayed both without sorting and sorting? I wanted to show this in a span tagg using this custom script but that only display the number of rows unfiltered.
$(document).ready(function() {
var table = $('#schedule').DataTable();
var info = table.page.info();
document.getElementById("tag").innerHTML = info.recordsDisplay;
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Do you mean filtered?
The
page.info()
API provides many values including this:Kevin
Yes I mean filtered, but that does not work. I already use that property and it still display the total number of rows even after filtering
Is the problem that the values aren't updated when searching? I would put that code into the
draw
event so it updates each time the table is drawn.Kevin
@kthorngren Thanks, that did the trick!