Created
March 26, 2022 09:34
-
-
Save annuman97/d2b64626fdeb08aef76877913cc5bfeb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Count rows of the table (it will work if filter is applied)*/ | |
function runAll(){ | |
var rowCount = FooTable.get('#footable_534').toJSON().rows.length; | |
var fixCount = FooTable.get('#footable_534').toJSON().rows.length; | |
var $countWrapper = $table.parent(); | |
$countWrapper.prepend('<div class="remove">Total <span>' + rowCount + "</span> data found</p>"); | |
$table.on('postdraw.ft.table', function(e, ft) { | |
jQuery('.remove').remove(); | |
var rowsCount = ft.rows.array.length; | |
$countWrapper.find('.table_info_count .current_count').html(rowsCount + " of " + fixCount); | |
}); | |
} | |
runAll(); | |
$table.on('after.ft.paging', function (e) { | |
e.preventDefault(); | |
runAll(); | |
}); | |
$table.on('after.ft.filtering', function (e) { | |
e.preventDefault(); | |
runAll(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment