mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager: current filters now updating properly. See #757
This commit is contained in:
parent
fcde1041be
commit
a20b37bfd0
@ -501,6 +501,7 @@
|
|||||||
|
|
||||||
counter = ++p.ajaxCounter;
|
counter = ++p.ajaxCounter;
|
||||||
|
|
||||||
|
p.last.ajaxUrl = url; // remember processed url
|
||||||
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||||
p.ajaxObject.success = function(data, status, jqxhr) {
|
p.ajaxObject.success = function(data, status, jqxhr) {
|
||||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||||
@ -831,14 +832,15 @@
|
|||||||
$t
|
$t
|
||||||
.unbind('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
|
.unbind('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
|
||||||
.bind('filterInit.pager filterStart.pager', function() {
|
.bind('filterInit.pager filterStart.pager', function() {
|
||||||
p.currentFilters = $t.data('lastSearch');
|
p.currentFilters = c.$table.data('lastSearch');
|
||||||
// don't change page is filters are the same (pager updating, etc)
|
// don't change page if filters are the same (pager updating, etc)
|
||||||
if (p.pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
|
if (p.pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
|
||||||
p.page = p.pageReset; // fixes #456 & #565
|
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(e) {
|
.bind('filterEnd.pager sortEnd.pager', function(e) {
|
||||||
|
p.currentFilters = c.$table.data('lastSearch');
|
||||||
if (p.initialized || p.initializing) {
|
if (p.initialized || p.initializing) {
|
||||||
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||||
// make sure we have a copy of all table rows once the cache has been built
|
// make sure we have a copy of all table rows once the cache has been built
|
||||||
|
@ -223,20 +223,20 @@ tsp = ts.pager = {
|
|||||||
.off('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
|
.off('filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet '.split(' ').join('.pager '))
|
||||||
.on('filterInit.pager filterStart.pager', function() {
|
.on('filterInit.pager filterStart.pager', function() {
|
||||||
p.currentFilters = c.$table.data('lastSearch');
|
p.currentFilters = c.$table.data('lastSearch');
|
||||||
// don't change page is filters are the same (pager updating, etc)
|
// don't change page if filters are the same (pager updating, etc)
|
||||||
if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
|
if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
|
||||||
p.page = wo.pager_pageReset; // fixes #456 & #565
|
p.page = wo.pager_pageReset; // fixes #456 & #565
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// update pager after filter widget completes
|
// update pager after filter widget completes
|
||||||
.on('filterEnd.pager sortEnd.pager', function() {
|
.on('filterEnd.pager sortEnd.pager', function() {
|
||||||
|
p.currentFilters = c.$table.data('lastSearch');
|
||||||
if (p.initialized || p.initializing) {
|
if (p.initialized || p.initializing) {
|
||||||
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||||
// make sure we have a copy of all table rows once the cache has been built
|
// make sure we have a copy of all table rows once the cache has been built
|
||||||
tsp.updateCache(table);
|
tsp.updateCache(table);
|
||||||
}
|
}
|
||||||
// tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
|
// tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
|
||||||
c.pager.last.page = -1;
|
|
||||||
c.$table.trigger('applyWidgets');
|
c.$table.trigger('applyWidgets');
|
||||||
tsp.updatePageDisplay(table, c, false);
|
tsp.updatePageDisplay(table, c, false);
|
||||||
}
|
}
|
||||||
@ -715,6 +715,7 @@ tsp = ts.pager = {
|
|||||||
$doc.off('ajaxError.pager');
|
$doc.off('ajaxError.pager');
|
||||||
});
|
});
|
||||||
counter = ++p.ajaxCounter;
|
counter = ++p.ajaxCounter;
|
||||||
|
p.last.ajaxUrl = url; // remember processed url
|
||||||
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||||
p.ajaxObject.success = function(data, status, jqxhr) {
|
p.ajaxObject.success = function(data, status, jqxhr) {
|
||||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||||
|
Loading…
Reference in New Issue
Block a user