I'm using jQuery plug-in jquery-tablesorter-filter. It works great. I have problem when I want to count how many rows after the table is filtered.
$("#tblContainer").tablesorter({
debug: false,
sortList: [
[0, 0]
],
widgets: ['zebra']
}).tablesorterFilter({
filterContainer: $("#filterBox"),
filterColumns: [1, 2],
filterCaseSensitive: false
});
Here's the code to count the filtered rows (rows that are currently on the screen). But it doesn't give me the correct result. It gave the last count of filtered rows instead of the current counts. It always give result with one key stroke behind.
$("#filterBox").keyup(function () {
var textLength = $("#filterBox").val().length;
if (textLength > 0) {
var rowCount = $("#tblContainer tr:visible").length;
$("#countCourseRow").html(" found " + rowCount);
} else {
$("#countCourseRow").html("");
}
});