allow first page and last page to be visible so users know how many pages there are

pull/6/head
Khoi 12 years ago
parent da04311c95
commit 16d8d2bfe4

@ -73,12 +73,7 @@ $.extend( $.fn.dataTableExt.oPagination, {
iEnd = iStart + iListLength - 1;
}
for ( i=0, ien=an.length ; i<ien ; i++ ) {
// Remove the middle elements
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
// Add the new list items and their event handlers
for ( j=iStart ; j<=iEnd ; j++ ) {
var append_page = function(oPaging, an, j) {
sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
$('<li '+sClass+'><a href="#">'+j+'</a></li>')
.insertBefore( $('li:last', an[i])[0] )
@ -87,6 +82,24 @@ $.extend( $.fn.dataTableExt.oPagination, {
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
fnDraw( oSettings );
} );
};
for ( i=0, ien=an.length ; i<ien ; i++ ) {
// Remove the middle elements
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
// Append first page
if ( iStart > 1 ) {
append_page(oPaging, an, 1);
}
// Add the new list items and their event handlers
for ( j=iStart ; j<=iEnd ; j++ ) {
append_page(oPaging, an, j);
}
// Append last page
if ( oPaging.iTotalPages > iEnd ) {
append_page(oPaging, an, oPaging.iTotalPages);
}
// Add / remove disabled classes from the static elements

Loading…
Cancel
Save