Pager: ensure ajax is called after filter widget initializes

This commit is contained in:
Rob Garrison 2017-05-23 13:40:22 -05:00
parent f7a60232a8
commit 30ee40c33f

View File

@ -244,12 +244,15 @@
wo = c.widgetOptions, wo = c.widgetOptions,
namespace = c.namespace + 'pager', namespace = c.namespace + 'pager',
s = wo.pager_selectors; s = wo.pager_selectors;
c.$table c.$table
.off( namespace ) .off( namespace )
.on( 'filterInit filterStart '.split( ' ' ).join( namespace + ' ' ), function( e, filters ) { .on( 'filterInit filterStart '.split( ' ' ).join( namespace + ' ' ), function( e, filters ) {
p.currentFilters = $.isArray( filters ) ? filters : c.$table.data( 'lastSearch' ); p.currentFilters = $.isArray( filters ) ? filters : c.$table.data( 'lastSearch' );
var filtersEqual; var filtersEqual;
if (p.ajax && e.type === 'filterInit') {
// ensure pager ajax is called after filter widget has initialized
return tsp.moveToPage( c, p, false );
}
if (ts.filter.equalFilters) { if (ts.filter.equalFilters) {
filtersEqual = ts.filter.equalFilters(c, c.lastSearch, p.currentFilters); filtersEqual = ts.filter.equalFilters(c, c.lastSearch, p.currentFilters);
} else { } else {
@ -270,7 +273,6 @@
tsp.updateCache( c ); tsp.updateCache( c );
} }
tsp.updatePageDisplay( c, false ); tsp.updatePageDisplay( c, false );
// tsp.moveToPage( c, p, false ); <-- called when applyWidgets is triggered
ts.applyWidget( c.table ); ts.applyWidget( c.table );
} }
}) })