mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager: Add pageReset option. Fixes #565
This commit is contained in:
parent
b258cd8c92
commit
f65e3dc9b3
@ -58,6 +58,10 @@
|
|||||||
// starting page of the pager (zero based index)
|
// starting page of the pager (zero based index)
|
||||||
page: 0,
|
page: 0,
|
||||||
|
|
||||||
|
// reset pager after filtering; set to desired page #
|
||||||
|
// set to false to not change page at filter start
|
||||||
|
pageReset: 0,
|
||||||
|
|
||||||
// Number of visible rows
|
// Number of visible rows
|
||||||
size: 10,
|
size: 10,
|
||||||
|
|
||||||
@ -674,7 +678,9 @@
|
|||||||
.unbind('filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize '.split(' ').join('.pager '))
|
.unbind('filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize '.split(' ').join('.pager '))
|
||||||
.bind('filterStart.pager', function(e, filters) {
|
.bind('filterStart.pager', function(e, filters) {
|
||||||
p.currentFilters = filters;
|
p.currentFilters = filters;
|
||||||
p.page = 0; // fixes #456
|
if (p.pageReset !== false) {
|
||||||
|
p.page = p.pageReset; // fixes #456 & #565
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// update pager after filter widget completes
|
// update pager after filter widget completes
|
||||||
.bind('filterEnd.pager sortEnd.pager', function() {
|
.bind('filterEnd.pager sortEnd.pager', function() {
|
||||||
|
@ -3176,6 +3176,14 @@ This ajaxProcessing function must return an object with "total", "headers" and "
|
|||||||
<td><a href="example-pager.html">Example</a></td>
|
<td><a href="example-pager.html">Example</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="pager-page-reset">
|
||||||
|
<td><span class="permalink">pageReset</span></td>
|
||||||
|
<td>Boolean Numeric</td>
|
||||||
|
<td>0</td>
|
||||||
|
<td>Reset pager to this page after filtering; set to desired page number (zero-based index), or <code>false</code> to not change page at filter start.</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="pager-size">
|
<tr id="pager-size">
|
||||||
<td><span class="permalink">size</span></td>
|
<td><span class="permalink">size</span></td>
|
||||||
<td>Numeric</td>
|
<td>Numeric</td>
|
||||||
|
@ -19,6 +19,10 @@ ts.addWidget({
|
|||||||
// starting page of the pager (zero based index)
|
// starting page of the pager (zero based index)
|
||||||
pager_startPage: 0,
|
pager_startPage: 0,
|
||||||
|
|
||||||
|
// reset pager after filtering; set to desired page #
|
||||||
|
// set to false to not change page at filter start
|
||||||
|
pager_pageReset: 0,
|
||||||
|
|
||||||
// Number of visible rows
|
// Number of visible rows
|
||||||
pager_size: 10,
|
pager_size: 10,
|
||||||
|
|
||||||
@ -210,7 +214,9 @@ tsp = ts.pager = {
|
|||||||
.unbind('filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize '.split(' ').join('.pager '))
|
.unbind('filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize '.split(' ').join('.pager '))
|
||||||
.bind('filterStart.pager', function(e, filters) {
|
.bind('filterStart.pager', function(e, filters) {
|
||||||
p.currentFilters = filters;
|
p.currentFilters = filters;
|
||||||
p.page = 0; // fixes #456
|
if (wo.pager_pageReset !== false) {
|
||||||
|
p.page = wo.pager_pageReset; // fixes #456 & #565
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// update pager after filter widget completes
|
// update pager after filter widget completes
|
||||||
.bind('filterEnd.pager sortEnd.pager', function() {
|
.bind('filterEnd.pager sortEnd.pager', function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user