mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
fixed pager page size selector - see issue #122
This commit is contained in:
parent
ce376f75ab
commit
470fee06e2
@ -11,7 +11,7 @@
|
|||||||
// target the pager markup
|
// target the pager markup
|
||||||
container: null,
|
container: null,
|
||||||
|
|
||||||
// use this format: "http:/mydatabase.com?page={page}&size={size}&{sortList:col}"
|
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}"
|
||||||
// where {page} is replaced by the page number and {size} is replaced by the number of records to show
|
// where {page} is replaced by the page number and {size} is replaced by the number of records to show
|
||||||
// {sortList:col} adds the sortList to the url into a "col" array.
|
// {sortList:col} adds the sortList to the url into a "col" array.
|
||||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
||||||
@ -167,7 +167,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
hideRowsSetup = function(table, c){
|
hideRowsSetup = function(table, c){
|
||||||
c.size = parseInt( $(c.cssPageSize, c.container).val(), 10 ) || c.size;
|
c.size = parseInt( $(c.cssPageSize, c.container).find('option[selected]').val(), 10 ) || c.size;
|
||||||
$.data(table, 'pagerLastSize', c.size);
|
$.data(table, 'pagerLastSize', c.size);
|
||||||
pagerArrows(c);
|
pagerArrows(c);
|
||||||
if ( !c.removeRows ) {
|
if ( !c.removeRows ) {
|
||||||
@ -389,7 +389,8 @@
|
|||||||
var p = $(c.cssPageSize, c.container).removeClass(c.cssDisabled).removeAttr('disabled');
|
var p = $(c.cssPageSize, c.container).removeClass(c.cssDisabled).removeAttr('disabled');
|
||||||
c.isDisabled = false;
|
c.isDisabled = false;
|
||||||
c.page = $.data(table, 'pagerLastPage') || c.page || 0;
|
c.page = $.data(table, 'pagerLastPage') || c.page || 0;
|
||||||
c.size = $.data(table, 'pagerLastSize') || parseInt(p.val(), 10) || c.size;
|
c.size = $.data(table, 'pagerLastSize') || parseInt(p.find('option[selected]').val(), 10) || c.size;
|
||||||
|
p.val(c.size); // set page size
|
||||||
c.totalPages = Math.ceil( Math.min( c.totalPages, c.filteredPages ) / c.size);
|
c.totalPages = Math.ceil( Math.min( c.totalPages, c.filteredPages ) / c.size);
|
||||||
if ( triggered ) {
|
if ( triggered ) {
|
||||||
$(table).trigger('update');
|
$(table).trigger('update');
|
||||||
@ -441,6 +442,7 @@
|
|||||||
changeHeight(table, c);
|
changeHeight(table, c);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $(c.cssGoto, pager).length ) {
|
if ( $(c.cssGoto, pager).length ) {
|
||||||
$(c.cssGoto, pager).bind('change', function(){
|
$(c.cssGoto, pager).bind('change', function(){
|
||||||
c.page = $(this).val() - 1;
|
c.page = $(this).val() - 1;
|
||||||
|
@ -201,7 +201,7 @@
|
|||||||
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
||||||
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
||||||
<select class="pagesize" title="Select page size">
|
<select class="pagesize" title="Select page size">
|
||||||
<option selected="selected" value="10">10</option>
|
<option value="10">10</option>
|
||||||
<option value="20">20</option>
|
<option value="20">20</option>
|
||||||
<option value="30">30</option>
|
<option value="30">30</option>
|
||||||
<option value="40">40</option>
|
<option value="40">40</option>
|
||||||
@ -493,7 +493,7 @@
|
|||||||
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
||||||
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
||||||
<select class="pagesize" title="Select page size">
|
<select class="pagesize" title="Select page size">
|
||||||
<option selected="selected" value="10">10</option>
|
<option value="10">10</option>
|
||||||
<option value="20">20</option>
|
<option value="20">20</option>
|
||||||
<option value="30">30</option>
|
<option value="30">30</option>
|
||||||
<option value="40">40</option>
|
<option value="40">40</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user