|
|
@ -56,7 +56,7 @@ $.extend( $.fn.dataTableExt.oPagination, {
|
|
|
|
var oPaging = oSettings.oInstance.fnPagingInfo();
|
|
|
|
var oPaging = oSettings.oInstance.fnPagingInfo();
|
|
|
|
var an = oSettings.aanFeatures.p;
|
|
|
|
var an = oSettings.aanFeatures.p;
|
|
|
|
var pages = [];
|
|
|
|
var pages = [];
|
|
|
|
var i, ien, klass;
|
|
|
|
var i, ien, klass, host;
|
|
|
|
|
|
|
|
|
|
|
|
// This could use some improving - however, see
|
|
|
|
// This could use some improving - however, see
|
|
|
|
// https://github.com/DataTables/DataTables/issues/163 - this will
|
|
|
|
// https://github.com/DataTables/DataTables/issues/163 - this will
|
|
|
@ -116,14 +116,15 @@ $.extend( $.fn.dataTableExt.oPagination, {
|
|
|
|
|
|
|
|
|
|
|
|
for ( i=0, ien=an.length ; i<ien ; i++ ) {
|
|
|
|
for ( i=0, ien=an.length ; i<ien ; i++ ) {
|
|
|
|
// Remove the middle elements
|
|
|
|
// Remove the middle elements
|
|
|
|
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
|
|
|
|
host = an[i];
|
|
|
|
|
|
|
|
$('li:gt(0)', host).filter(':not(:last)').remove();
|
|
|
|
|
|
|
|
|
|
|
|
// Add the new list items and their event handlers
|
|
|
|
// Add the new list items and their event handlers
|
|
|
|
$.each( pages, function( i, page ) {
|
|
|
|
$.each( pages, function( i, page ) {
|
|
|
|
klass = page === null ? 'unavailable' :
|
|
|
|
klass = page === null ? 'unavailable' :
|
|
|
|
page === oPaging.iPage ? 'current' : '';
|
|
|
|
page === oPaging.iPage ? 'current' : '';
|
|
|
|
$('<li class="'+klass+'"><a href="">'+(page===null? '…' : page+1)+'</a></li>')
|
|
|
|
$('<li class="'+klass+'"><a href="">'+(page===null? '…' : page+1)+'</a></li>')
|
|
|
|
.insertBefore( $('li:last', an[i]) )
|
|
|
|
.insertBefore( $('li:last', host) )
|
|
|
|
.bind('click', function (e) {
|
|
|
|
.bind('click', function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
|
|
|
|
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
|
|
|
@ -133,15 +134,15 @@ $.extend( $.fn.dataTableExt.oPagination, {
|
|
|
|
|
|
|
|
|
|
|
|
// Add / remove disabled classes from the static elements
|
|
|
|
// Add / remove disabled classes from the static elements
|
|
|
|
if ( oPaging.iPage === 0 ) {
|
|
|
|
if ( oPaging.iPage === 0 ) {
|
|
|
|
$('li:first', an[i]).addClass('unavailable');
|
|
|
|
$('li:first', host).addClass('unavailable');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$('li:first', an[i]).removeClass('unavailable');
|
|
|
|
$('li:first', host).removeClass('unavailable');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
|
|
|
|
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
|
|
|
|
$('li:last', an[i]).addClass('unavailable');
|
|
|
|
$('li:last', host).addClass('unavailable');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$('li:last', an[i]).removeClass('unavailable');
|
|
|
|
$('li:last', host).removeClass('unavailable');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|