mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager-custom-controls: spacer settings now include wrapper element
This commit is contained in:
parent
a4ad8fd7b3
commit
d18d2834ed
@ -27,8 +27,8 @@ $.tablesorter.customPagerControls = function(settings) {
|
|||||||
aroundCurrent : 1, // number of pages surrounding the current page
|
aroundCurrent : 1, // number of pages surrounding the current page
|
||||||
link : '<a href="#">{page}</a>', // page element; use {page} to include the page number
|
link : '<a href="#">{page}</a>', // page element; use {page} to include the page number
|
||||||
currentClass : 'current', // current page class name
|
currentClass : 'current', // current page class name
|
||||||
adjacentSpacer : ' | ', // spacer for page numbers next to each other
|
adjacentSpacer : '<span> | </span>', // spacer for page numbers next to each other
|
||||||
distanceSpacer : ' … ', // spacer for page numbers away from each other (ellipsis)
|
distanceSpacer : '<span> … <span>', // spacer for page numbers away from each other (ellipsis)
|
||||||
addKeyboard : true // add left/right keyboard arrows to change current page
|
addKeyboard : true // add left/right keyboard arrows to change current page
|
||||||
},
|
},
|
||||||
options = $.extend({}, defaults, settings),
|
options = $.extend({}, defaults, settings),
|
||||||
@ -70,9 +70,15 @@ $.tablesorter.customPagerControls = function(settings) {
|
|||||||
max = pageArray.length - 1;
|
max = pageArray.length - 1;
|
||||||
$.each(pageArray, function(indx, value) {
|
$.each(pageArray, function(indx, value) {
|
||||||
pages
|
pages
|
||||||
.append( $(options.link.replace(/\{page\}/g, value)).toggleClass(options.currentClass, value === cur).attr('data-page', value) )
|
.append(
|
||||||
.append( '<span>' + (indx < pageArray.length - 1 && ( pageArray[ indx + 1 ] - 1 !== value ) ? options.distanceSpacer :
|
$(options.link.replace(/\{page\}/g, value))
|
||||||
( indx >= pageArray.length - 1 ? '' : options.adjacentSpacer )) + '</span>' );
|
.toggleClass(options.currentClass, value === cur)
|
||||||
|
.attr('data-page', value)
|
||||||
|
)
|
||||||
|
.append((indx < max && (pageArray[ indx + 1 ] - 1 !== value) ?
|
||||||
|
options.distanceSpacer :
|
||||||
|
(indx >= max ? '' : options.adjacentSpacer)
|
||||||
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user