Merge pull request #20 from leoleozhu/master

Fix two issues in  ellipsis pagination
pull/8/merge
Allan Jardine 12 years ago
commit 4bca2005f3

@ -82,26 +82,28 @@ $.fn.dataTableExt.oPagination.ellipses = {
var oClasses = oSettings.oClasses, var oClasses = oSettings.oClasses,
that = this; that = this;
var tableWrapper = oSettings.nTableWrapper;
// Update stateful properties // Update stateful properties
this.fnUpdateState(oSettings); this.fnUpdateState(oSettings);
if (oSettings._iCurrentPage === 1) { if (oSettings._iCurrentPage === 1) {
$('.' + oClasses.sPageFirst).attr('disabled', true); $('.' + oClasses.sPageFirst, tableWrapper).attr('disabled', true);
$('.' + oClasses.sPagePrevious).attr('disabled', true); $('.' + oClasses.sPagePrevious, tableWrapper).attr('disabled', true);
} else { } else {
$('.' + oClasses.sPageFirst).removeAttr('disabled'); $('.' + oClasses.sPageFirst, tableWrapper).removeAttr('disabled');
$('.' + oClasses.sPagePrevious).removeAttr('disabled'); $('.' + oClasses.sPagePrevious, tableWrapper).removeAttr('disabled');
} }
if (oSettings._iCurrentPage === oSettings._iTotalPages) { if (oSettings._iTotalPages === 0 || oSettings._iCurrentPage === oSettings._iTotalPages) {
$('.' + oClasses.sPageNext).attr('disabled', true); $('.' + oClasses.sPageNext, tableWrapper).attr('disabled', true);
$('.' + oClasses.sPageLast).attr('disabled', true); $('.' + oClasses.sPageLast, tableWrapper).attr('disabled', true);
} else { } else {
$('.' + oClasses.sPageNext).removeAttr('disabled'); $('.' + oClasses.sPageNext, tableWrapper).removeAttr('disabled');
$('.' + oClasses.sPageLast).removeAttr('disabled'); $('.' + oClasses.sPageLast, tableWrapper).removeAttr('disabled');
} }
var i, oNumber, oNumbers = $('.' + oClasses.sPageNumbers); var i, oNumber, oNumbers = $('.' + oClasses.sPageNumbers, tableWrapper);
// Erase // Erase
oNumbers.html(''); oNumbers.html('');
@ -154,4 +156,4 @@ $.fn.dataTableExt.oPagination.ellipses = {
_iLastPage: iLastPage _iLastPage: iLastPage
}); });
} }
}; };

Loading…
Cancel
Save