mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager: use equalFilters for comparison. See #1384
This commit is contained in:
parent
39a1772b25
commit
07f9dd9f60
@ -968,11 +968,15 @@
|
||||
.unbind( pagerEvents.split(' ').join(namespace + ' ').replace(/\s+/g, ' ') )
|
||||
.bind('filterInit filterStart '.split(' ').join(namespace + ' '), function(e, filters) {
|
||||
p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
|
||||
var filtersEqual;
|
||||
if (ts.filter.equalFilters) {
|
||||
filtersEqual = ts.filter.equalFilters(c, c.lastSearch, p.currentFilters);
|
||||
} else {
|
||||
// will miss filter changes of the same value in a different column, see #1363
|
||||
filtersEqual = (c.lastSearch || []).join('') !== (p.currentFilters || []).join('');
|
||||
}
|
||||
// don't change page if filters are the same (pager updating, etc)
|
||||
if (
|
||||
e.type === 'filterStart' &&
|
||||
p.pageReset !== false &&
|
||||
(c.lastSearch || []).join(',') !== (p.currentFilters || []).join(',')) {
|
||||
if (e.type === 'filterStart' && p.pageReset !== false && !filtersEqual) {
|
||||
p.page = p.pageReset; // fixes #456 & #565
|
||||
}
|
||||
})
|
||||
|
@ -249,10 +249,15 @@
|
||||
.off( namespace )
|
||||
.on( 'filterInit filterStart '.split( ' ' ).join( namespace + ' ' ), function( e, filters ) {
|
||||
p.currentFilters = $.isArray( filters ) ? filters : c.$table.data( 'lastSearch' );
|
||||
var filtersEqual;
|
||||
if (ts.filter.equalFilters) {
|
||||
filtersEqual = ts.filter.equalFilters(c, c.lastSearch, p.currentFilters);
|
||||
} else {
|
||||
// will miss filter changes of the same value in a different column, see #1363
|
||||
filtersEqual = ( c.lastSearch || [] ).join( '' ) !== ( p.currentFilters || [] ).join( '' );
|
||||
}
|
||||
// don't change page if filters are the same (pager updating, etc)
|
||||
if ( e.type === 'filterStart' && wo.pager_pageReset !== false &&
|
||||
( c.lastSearch || [] ).join( ',' ) !== ( p.currentFilters || [] ).join( ',' )
|
||||
) {
|
||||
if ( e.type === 'filterStart' && wo.pager_pageReset !== false && !filtersEqual ) {
|
||||
p.page = wo.pager_pageReset; // fixes #456 & #565
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user