My variation which can be copied and pasted for any table regardless of how many are on the page.
You may need to change the jQuery traverse for the paginateRow variable.
[code]
"fnDrawCallback": function() {
var paginateRow = $(this).parent().prev().children('div.dataTables_paginate');
var pageCount = Math.ceil((this.fnSettings().fnRecordsDisplay()) / this.fnSettings()._iDisplayLength);
Nice update - thanks for posting your code :-). This is something that could even be wrapped up into a feature plug-in: http://datatables.net/blog/Creating_feature_plug-ins ;-)
Replies
http://datatables.net/forums/comments.php?DiscussionID=131&page=1#Item_18
I use this:
[code]
"fnDrawCallback": function() {
if (Math.ceil((oTable.fnSettings().fnRecordsDisplay()) / oTable.fnSettings()._iDisplayLength) > 1) {
$('#example_paginate)[0].style.display = "block";
} else {
$('#example_paginate')[0].style.display = "none";
}
}
[/code]
[code]
"fnDrawCallback": function() {
if (Math.ceil((this.fnSettings().fnRecordsDisplay()) / this.fnSettings()._iDisplayLength) > 1) {
$('.dataTables_paginate').css("display", "block");
} else {
$('.dataTables_paginate').css("display", "none");
}
}
[/code]
Thanks very much for the hint ;)
You may need to change the jQuery traverse for the paginateRow variable.
[code]
"fnDrawCallback": function() {
var paginateRow = $(this).parent().prev().children('div.dataTables_paginate');
var pageCount = Math.ceil((this.fnSettings().fnRecordsDisplay()) / this.fnSettings()._iDisplayLength);
if (pageCount > 1) {
paginateRow.css("display", "block");
} else {
paginateRow.css("display", "none");
}
}
[/code]
Allan