Global: Use triggerHandler to prevent event bubble to any outer table

This commit is contained in:
Rob Garrison 2015-12-01 19:38:56 -06:00
parent 78c23a0bc1
commit 87a10d6987
35 changed files with 232 additions and 185 deletions

View File

@ -217,7 +217,7 @@
$out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function(){ $out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function(){
var v = $(this).val(), var v = $(this).val(),
pg = $(this).hasClass('ts-startRow') ? Math.floor( v / p.size ) + 1 : v; pg = $(this).hasClass('ts-startRow') ? Math.floor( v / p.size ) + 1 : v;
c.$table.trigger('pageSet' + namespace, [ pg ]); c.$table.triggerHandler('pageSet' + namespace, [ pg ]);
}); });
} }
} }
@ -227,7 +227,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerComplete'); console.log('Pager: Triggering pagerComplete');
} }
c.$table.trigger('pagerComplete', p); c.$table.triggerHandler('pagerComplete', p);
// save pager info to storage // save pager info to storage
if (p.savePages && ts.storage) { if (p.savePages && ts.storage) {
ts.storage(table, p.storageKey, { ts.storage(table, p.storageKey, {
@ -499,7 +499,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
$table.trigger( 'pagerChange', p ); $table.triggerHandler( 'pagerChange', p );
ts.applyWidget( table ); ts.applyWidget( table );
updatePageDisplay(table, p, true); updatePageDisplay(table, p, true);
}, 0); }, 0);
@ -513,7 +513,7 @@
if (table.config.debug) { if (table.config.debug) {
console.log('Pager: Triggering pagerInitialized'); console.log('Pager: Triggering pagerInitialized');
} }
$(table).trigger( 'pagerInitialized', p ); $(table).triggerHandler( 'pagerInitialized', p );
ts.applyWidget( table ); ts.applyWidget( table );
updatePageDisplay(table, p); updatePageDisplay(table, p);
} }
@ -624,7 +624,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
$t.trigger( 'pagerChange', p ); $t.triggerHandler( 'pagerChange', p );
} }
if ( !p.removeRows ) { if ( !p.removeRows ) {
hideRows(table, p); hideRows(table, p);
@ -654,7 +654,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering updateComplete'); console.log('Pager: Triggering updateComplete');
} }
$t.trigger('updateComplete', [ table, true ]); $t.triggerHandler('updateComplete', [ table, true ]);
} }
}, },
@ -756,13 +756,13 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pageMoved'); console.log('Pager: Triggering pageMoved');
} }
$t.trigger('pageMoved', p); $t.triggerHandler('pageMoved', p);
ts.applyWidget( table ); ts.applyWidget( table );
if (table.isUpdating) { if (table.isUpdating) {
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering updateComplete'); console.log('Pager: Triggering updateComplete');
} }
$t.trigger('updateComplete', [ table, true ]); $t.triggerHandler('updateComplete', [ table, true ]);
} }
} }
}, },
@ -1059,7 +1059,7 @@
// clear initialized flag // clear initialized flag
p.initialized = false; p.initialized = false;
// before initialization event // before initialization event
$t.trigger('pagerBeforeInitialized', p); $t.triggerHandler('pagerBeforeInitialized', p);
enablePager(table, p, false); enablePager(table, p, false);
if ( typeof p.ajaxUrl === 'string' ) { if ( typeof p.ajaxUrl === 'string' ) {
@ -1085,7 +1085,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerInitialized'); console.log('Pager: Triggering pagerInitialized');
} }
c.$table.trigger( 'pagerInitialized', p ); c.$table.triggerHandler( 'pagerInitialized', p );
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) { if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
updatePageDisplay(table, p, false); updatePageDisplay(table, p, false);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/ /*! tablesorter (FORK) - updated 12-01-2015 (v2.24.6)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -344,7 +344,7 @@
console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) ); console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
if ( c.debug && console.groupEnd ) { console.groupEnd(); } if ( c.debug && console.groupEnd ) { console.groupEnd(); }
} }
$table.trigger( 'tablesorter-initialized', table ); $table.triggerHandler( 'tablesorter-initialized', table );
if ( typeof c.initialized === 'function' ) { if ( typeof c.initialized === 'function' ) {
c.initialized( table ); c.initialized( table );
} }
@ -951,7 +951,20 @@
ts.isProcessing( table ); // remove processing icon ts.isProcessing( table ); // remove processing icon
} }
if ( c.debug ) { if ( c.debug ) {
console.log( 'Building cache for ' + totalRows + ' rows' + ts.benchmark( cacheTime ) ); len = Math.min( 5, c.totalRows );
console[ console.group ? 'group' : 'log' ]( 'Building cache for ' + totalRows +
' rows (showing ' + len + ' rows)' + ts.benchmark( cacheTime ) );
val = {};
for ( colIndex = 0; colIndex < c.columns; colIndex++ ) {
for ( cacheIndex = 0; cacheIndex < len; cacheIndex++ ) {
if ( !val[ 'row: ' + cacheIndex ] ) {
val[ 'row: ' + cacheIndex ] = {};
}
val[ 'row: ' + cacheIndex ][ c.headerContent[ colIndex ] ] = cache.normalized[ cacheIndex ][ colIndex ];
}
}
console[ console.table ? 'table' : 'log' ]( val );
if ( console.groupEnd ) { console.groupEnd(); }
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1358,7 +1371,7 @@
if ( ts.isEmptyObject( cache ) ) { if ( ts.isEmptyObject( cache ) ) {
// run pager appender in case the table was just emptied // run pager appender in case the table was just emptied
return c.appender ? c.appender( table, rows ) : return c.appender ? c.appender( table, rows ) :
table.isUpdating ? c.$table.trigger( 'updateComplete', table ) : ''; // Fixes #532 table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
} }
if ( c.debug ) { if ( c.debug ) {
appendTime = new Date(); appendTime = new Date();
@ -1392,7 +1405,7 @@
ts.applyWidget( table ); ts.applyWidget( table );
} }
if ( table.isUpdating ) { if ( table.isUpdating ) {
c.$table.trigger( 'updateComplete', table ); c.$table.triggerHandler( 'updateComplete', table );
} }
}, },
@ -1428,7 +1441,7 @@
order = c.sortVars[ col ].order; order = c.sortVars[ col ].order;
// Only call sortStart if sorting is enabled // Only call sortStart if sorting is enabled
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// get current column sort order // get current column sort order
c.sortVars[ col ].count = c.sortVars[ col ].count =
event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 ); event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
@ -1539,14 +1552,14 @@
} }
} }
// sortBegin event triggered immediately before the sort // sortBegin event triggered immediately before the sort
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// setTimeout needed so the processing icon shows up // setTimeout needed so the processing icon shows up
setTimeout( function() { setTimeout( function() {
// set css for headers // set css for headers
ts.setHeadersCss( c ); ts.setHeadersCss( c );
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c ); ts.appendCache( c );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
}, 1 ); }, 1 );
}, },
@ -1622,7 +1635,7 @@
resortComplete : function( c, callback ) { resortComplete : function( c, callback ) {
if ( c.table.isUpdating ) { if ( c.table.isUpdating ) {
c.$table.trigger( 'updateComplete', c.table ); c.$table.triggerHandler( 'updateComplete', c.table );
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( c.table ); callback( c.table );
@ -1654,7 +1667,7 @@
sortOn : function( c, list, callback, init ) { sortOn : function( c, list, callback, init ) {
var table = c.table; var table = c.table;
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// update header count index // update header count index
ts.updateHeaderSortCount( c, list ); ts.updateHeaderSortCount( c, list );
// set css for headers // set css for headers
@ -1663,11 +1676,11 @@
if ( c.delayInit && ts.isEmptyObject( c.cache ) ) { if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
ts.buildCache( c ); ts.buildCache( c );
} }
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// sort the table and append it to the dom // sort the table and append it to the dom
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c, init ); ts.appendCache( c, init );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
ts.applyWidget( table ); ts.applyWidget( table );
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1933,7 +1946,7 @@
c.timerReady = setTimeout( function() { c.timerReady = setTimeout( function() {
table.isApplyingWidgets = false; table.isApplyingWidgets = false;
$.data( table, 'lastWidgetApplication', new Date() ); $.data( table, 'lastWidgetApplication', new Date() );
c.$table.trigger( 'tablesorter-ready' ); c.$table.triggerHandler( 'tablesorter-ready' );
}, 10 ); }, 10 );
if ( c.debug ) { if ( c.debug ) {
widget = c.widgets.length; widget = c.widgets.length;
@ -1989,7 +2002,7 @@
len = widgets.length, len = widgets.length,
list = [], list = [],
callback = function( table ) { callback = function( table ) {
$( table ).trigger( 'refreshComplete' ); $( table ).triggerHandler( 'refreshComplete' );
}; };
// remove widgets not defined in config.widgets, unless doAll is true // remove widgets not defined in config.widgets, unless doAll is true
for ( indx = 0; indx < len; indx++ ) { for ( indx = 0; indx < len; indx++ ) {
@ -2314,8 +2327,8 @@
$f = $t.find( 'tfoot:first > tr' ).children( 'th, td' ); $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) { if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) {
// reapply uitheme classes, in case we want to maintain appearance // reapply uitheme classes, in case we want to maintain appearance
$t.trigger( 'applyWidgetId', [ 'uitheme' ] ); $t.triggerHandler( 'applyWidgetId', [ 'uitheme' ] );
$t.trigger( 'applyWidgetId', [ 'zebra' ] ); $t.triggerHandler( 'applyWidgetId', [ 'zebra' ] );
} }
// remove widget added rows, just in case // remove widget added rows, just in case
$h.find( 'tr' ).not( $r ).remove(); $h.find( 'tr' ).not( $r ).remove();
@ -3431,7 +3444,7 @@
if ( wo.filter_reset instanceof $ ) { if ( wo.filter_reset instanceof $ ) {
// reset contains a jQuery object, bind to it // reset contains a jQuery object, bind to it
wo.filter_reset.click( function() { wo.filter_reset.click( function() {
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} else if ( $( wo.filter_reset ).length ) { } else if ( $( wo.filter_reset ).length ) {
// reset is a jQuery selector, use event delegation // reset is a jQuery selector, use event delegation
@ -3439,7 +3452,7 @@
.undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' ) .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
.delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() { .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
// trigger a reset event, so other functions ( filter_formatter ) know when to reset // trigger a reset event, so other functions ( filter_formatter ) know when to reset
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} }
} }
@ -3541,7 +3554,7 @@
ts.setFilters( table, filters, true ); ts.setFilters( table, filters, true );
} }
} }
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout( function() { setTimeout( function() {
if ( !wo.filter_initialized ) { if ( !wo.filter_initialized ) {
@ -3551,7 +3564,7 @@
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if ( c.pager && c.pager.initialized && !wo.filter_initialized ) { if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
setTimeout( function() { setTimeout( function() {
tsf.filterInitComplete( c ); tsf.filterInitComplete( c );
}, 100 ); }, 100 );
@ -3574,7 +3587,7 @@
count = 0, count = 0,
completed = function() { completed = function() {
wo.filter_initialized = true; wo.filter_initialized = true;
c.$table.trigger( 'filterInit', c ); c.$table.triggerHandler( 'filterInit', c );
tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] ); tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] );
}; };
if ( $.isEmptyObject( wo.filter_formatter ) ) { if ( $.isEmptyObject( wo.filter_formatter ) ) {
@ -3822,7 +3835,7 @@
// show/hide filter row as needed // show/hide filter row as needed
c.$table c.$table
.find( '.' + tscss.filterRow ) .find( '.' + tscss.filterRow )
.trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' ); .triggerHandler( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
@ -3833,6 +3846,8 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
} }
// define filter inside it is false
filters = filters || [];
// convert filters to strings - see #1070 // convert filters to strings - see #1070
filters = Array.prototype.map ? filters = Array.prototype.map ?
filters.map( String ) : filters.map( String ) :
@ -3840,7 +3855,7 @@
filters.join( '\u0000' ).split( '\u0000' ); filters.join( '\u0000' ).split( '\u0000' );
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterStart', [ filters ] ); c.$table.triggerHandler( 'filterStart', [ filters ] );
} }
if ( c.showProcessing ) { if ( c.showProcessing ) {
// give it time for the processing icon to kick in // give it time for the processing icon to kick in
@ -4376,7 +4391,7 @@
console.log( 'Completed filter widget search' + ts.benchmark(time) ); console.log( 'Completed filter widget search' + ts.benchmark(time) );
} }
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterEnd', c ); c.$table.triggerHandler( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
ts.applyWidget( c.table ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
@ -4741,7 +4756,7 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
tsf.searching( c.table, filter, skipFirst ); tsf.searching( c.table, filter, skipFirst );
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
} }
return !!valid; return !!valid;
}; };
@ -4789,7 +4804,7 @@
} }
} }
if ( headers.length && triggerEvent !== false ) { if ( headers.length && triggerEvent !== false ) {
c.$table.trigger( 'resize', [ headers ] ); c.$table.triggerHandler( 'resize', [ headers ] );
} }
wo.resize_flag = false; wo.resize_flag = false;
}; };
@ -5016,7 +5031,7 @@
} }
} }
$table.trigger('stickyHeadersInit'); $table.triggerHandler('stickyHeadersInit');
}, },
remove: function(table, c, wo) { remove: function(table, c, wo) {
@ -5344,7 +5359,7 @@
} }
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
// dynamically update sticky header widths // dynamically update sticky header widths
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
}, },
stopResize : function( c, wo ) { stopResize : function( c, wo ) {
@ -5358,7 +5373,7 @@
vars.mouseXPosition = 0; vars.mouseXPosition = 0;
vars.$target = vars.$next = null; vars.$target = vars.$next = null;
// will update stickyHeaders, just in case, see #912 // will update stickyHeaders, just in case, see #912
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
} }
}; };
@ -5420,7 +5435,7 @@
} }
// reset stickyHeader widths // reset stickyHeader widths
c.$table.trigger( 'stickyHeadersUpdate' ); c.$table.triggerHandler( 'stickyHeadersUpdate' );
if ( ts.storage && !refreshing ) { if ( ts.storage && !refreshing ) {
ts.storage( this, ts.css.resizableStorage, {} ); ts.storage( this, ts.css.resizableStorage, {} );
} }

File diff suppressed because one or more lines are too long

View File

@ -342,7 +342,7 @@
console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) ); console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
if ( c.debug && console.groupEnd ) { console.groupEnd(); } if ( c.debug && console.groupEnd ) { console.groupEnd(); }
} }
$table.trigger( 'tablesorter-initialized', table ); $table.triggerHandler( 'tablesorter-initialized', table );
if ( typeof c.initialized === 'function' ) { if ( typeof c.initialized === 'function' ) {
c.initialized( table ); c.initialized( table );
} }
@ -949,7 +949,20 @@
ts.isProcessing( table ); // remove processing icon ts.isProcessing( table ); // remove processing icon
} }
if ( c.debug ) { if ( c.debug ) {
console.log( 'Building cache for ' + totalRows + ' rows' + ts.benchmark( cacheTime ) ); len = Math.min( 5, c.totalRows );
console[ console.group ? 'group' : 'log' ]( 'Building cache for ' + totalRows +
' rows (showing ' + len + ' rows)' + ts.benchmark( cacheTime ) );
val = {};
for ( colIndex = 0; colIndex < c.columns; colIndex++ ) {
for ( cacheIndex = 0; cacheIndex < len; cacheIndex++ ) {
if ( !val[ 'row: ' + cacheIndex ] ) {
val[ 'row: ' + cacheIndex ] = {};
}
val[ 'row: ' + cacheIndex ][ c.headerContent[ colIndex ] ] = cache.normalized[ cacheIndex ][ colIndex ];
}
}
console[ console.table ? 'table' : 'log' ]( val );
if ( console.groupEnd ) { console.groupEnd(); }
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1356,7 +1369,7 @@
if ( ts.isEmptyObject( cache ) ) { if ( ts.isEmptyObject( cache ) ) {
// run pager appender in case the table was just emptied // run pager appender in case the table was just emptied
return c.appender ? c.appender( table, rows ) : return c.appender ? c.appender( table, rows ) :
table.isUpdating ? c.$table.trigger( 'updateComplete', table ) : ''; // Fixes #532 table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
} }
if ( c.debug ) { if ( c.debug ) {
appendTime = new Date(); appendTime = new Date();
@ -1390,7 +1403,7 @@
ts.applyWidget( table ); ts.applyWidget( table );
} }
if ( table.isUpdating ) { if ( table.isUpdating ) {
c.$table.trigger( 'updateComplete', table ); c.$table.triggerHandler( 'updateComplete', table );
} }
}, },
@ -1426,7 +1439,7 @@
order = c.sortVars[ col ].order; order = c.sortVars[ col ].order;
// Only call sortStart if sorting is enabled // Only call sortStart if sorting is enabled
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// get current column sort order // get current column sort order
c.sortVars[ col ].count = c.sortVars[ col ].count =
event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 ); event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
@ -1537,14 +1550,14 @@
} }
} }
// sortBegin event triggered immediately before the sort // sortBegin event triggered immediately before the sort
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// setTimeout needed so the processing icon shows up // setTimeout needed so the processing icon shows up
setTimeout( function() { setTimeout( function() {
// set css for headers // set css for headers
ts.setHeadersCss( c ); ts.setHeadersCss( c );
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c ); ts.appendCache( c );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
}, 1 ); }, 1 );
}, },
@ -1620,7 +1633,7 @@
resortComplete : function( c, callback ) { resortComplete : function( c, callback ) {
if ( c.table.isUpdating ) { if ( c.table.isUpdating ) {
c.$table.trigger( 'updateComplete', c.table ); c.$table.triggerHandler( 'updateComplete', c.table );
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( c.table ); callback( c.table );
@ -1652,7 +1665,7 @@
sortOn : function( c, list, callback, init ) { sortOn : function( c, list, callback, init ) {
var table = c.table; var table = c.table;
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// update header count index // update header count index
ts.updateHeaderSortCount( c, list ); ts.updateHeaderSortCount( c, list );
// set css for headers // set css for headers
@ -1661,11 +1674,11 @@
if ( c.delayInit && ts.isEmptyObject( c.cache ) ) { if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
ts.buildCache( c ); ts.buildCache( c );
} }
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// sort the table and append it to the dom // sort the table and append it to the dom
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c, init ); ts.appendCache( c, init );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
ts.applyWidget( table ); ts.applyWidget( table );
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1931,7 +1944,7 @@
c.timerReady = setTimeout( function() { c.timerReady = setTimeout( function() {
table.isApplyingWidgets = false; table.isApplyingWidgets = false;
$.data( table, 'lastWidgetApplication', new Date() ); $.data( table, 'lastWidgetApplication', new Date() );
c.$table.trigger( 'tablesorter-ready' ); c.$table.triggerHandler( 'tablesorter-ready' );
}, 10 ); }, 10 );
if ( c.debug ) { if ( c.debug ) {
widget = c.widgets.length; widget = c.widgets.length;
@ -1987,7 +2000,7 @@
len = widgets.length, len = widgets.length,
list = [], list = [],
callback = function( table ) { callback = function( table ) {
$( table ).trigger( 'refreshComplete' ); $( table ).triggerHandler( 'refreshComplete' );
}; };
// remove widgets not defined in config.widgets, unless doAll is true // remove widgets not defined in config.widgets, unless doAll is true
for ( indx = 0; indx < len; indx++ ) { for ( indx = 0; indx < len; indx++ ) {
@ -2312,8 +2325,8 @@
$f = $t.find( 'tfoot:first > tr' ).children( 'th, td' ); $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) { if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) {
// reapply uitheme classes, in case we want to maintain appearance // reapply uitheme classes, in case we want to maintain appearance
$t.trigger( 'applyWidgetId', [ 'uitheme' ] ); $t.triggerHandler( 'applyWidgetId', [ 'uitheme' ] );
$t.trigger( 'applyWidgetId', [ 'zebra' ] ); $t.triggerHandler( 'applyWidgetId', [ 'zebra' ] );
} }
// remove widget added rows, just in case // remove widget added rows, just in case
$h.find( 'tr' ).not( $r ).remove(); $h.find( 'tr' ).not( $r ).remove();

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/ /*! tablesorter (FORK) - updated 12-01-2015 (v2.24.6)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -798,7 +798,7 @@
if ( wo.filter_reset instanceof $ ) { if ( wo.filter_reset instanceof $ ) {
// reset contains a jQuery object, bind to it // reset contains a jQuery object, bind to it
wo.filter_reset.click( function() { wo.filter_reset.click( function() {
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} else if ( $( wo.filter_reset ).length ) { } else if ( $( wo.filter_reset ).length ) {
// reset is a jQuery selector, use event delegation // reset is a jQuery selector, use event delegation
@ -806,7 +806,7 @@
.undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' ) .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
.delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() { .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
// trigger a reset event, so other functions ( filter_formatter ) know when to reset // trigger a reset event, so other functions ( filter_formatter ) know when to reset
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} }
} }
@ -908,7 +908,7 @@
ts.setFilters( table, filters, true ); ts.setFilters( table, filters, true );
} }
} }
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout( function() { setTimeout( function() {
if ( !wo.filter_initialized ) { if ( !wo.filter_initialized ) {
@ -918,7 +918,7 @@
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if ( c.pager && c.pager.initialized && !wo.filter_initialized ) { if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
setTimeout( function() { setTimeout( function() {
tsf.filterInitComplete( c ); tsf.filterInitComplete( c );
}, 100 ); }, 100 );
@ -941,7 +941,7 @@
count = 0, count = 0,
completed = function() { completed = function() {
wo.filter_initialized = true; wo.filter_initialized = true;
c.$table.trigger( 'filterInit', c ); c.$table.triggerHandler( 'filterInit', c );
tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] ); tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] );
}; };
if ( $.isEmptyObject( wo.filter_formatter ) ) { if ( $.isEmptyObject( wo.filter_formatter ) ) {
@ -1189,7 +1189,7 @@
// show/hide filter row as needed // show/hide filter row as needed
c.$table c.$table
.find( '.' + tscss.filterRow ) .find( '.' + tscss.filterRow )
.trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' ); .triggerHandler( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
@ -1200,6 +1200,8 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
} }
// define filter inside it is false
filters = filters || [];
// convert filters to strings - see #1070 // convert filters to strings - see #1070
filters = Array.prototype.map ? filters = Array.prototype.map ?
filters.map( String ) : filters.map( String ) :
@ -1207,7 +1209,7 @@
filters.join( '\u0000' ).split( '\u0000' ); filters.join( '\u0000' ).split( '\u0000' );
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterStart', [ filters ] ); c.$table.triggerHandler( 'filterStart', [ filters ] );
} }
if ( c.showProcessing ) { if ( c.showProcessing ) {
// give it time for the processing icon to kick in // give it time for the processing icon to kick in
@ -1743,7 +1745,7 @@
console.log( 'Completed filter widget search' + ts.benchmark(time) ); console.log( 'Completed filter widget search' + ts.benchmark(time) );
} }
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterEnd', c ); c.$table.triggerHandler( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
ts.applyWidget( c.table ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
@ -2108,7 +2110,7 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
tsf.searching( c.table, filter, skipFirst ); tsf.searching( c.table, filter, skipFirst );
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
} }
return !!valid; return !!valid;
}; };
@ -2156,7 +2158,7 @@
} }
} }
if ( headers.length && triggerEvent !== false ) { if ( headers.length && triggerEvent !== false ) {
c.$table.trigger( 'resize', [ headers ] ); c.$table.triggerHandler( 'resize', [ headers ] );
} }
wo.resize_flag = false; wo.resize_flag = false;
}; };
@ -2383,7 +2385,7 @@
} }
} }
$table.trigger('stickyHeadersInit'); $table.triggerHandler('stickyHeadersInit');
}, },
remove: function(table, c, wo) { remove: function(table, c, wo) {
@ -2711,7 +2713,7 @@
} }
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
// dynamically update sticky header widths // dynamically update sticky header widths
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
}, },
stopResize : function( c, wo ) { stopResize : function( c, wo ) {
@ -2725,7 +2727,7 @@
vars.mouseXPosition = 0; vars.mouseXPosition = 0;
vars.$target = vars.$next = null; vars.$target = vars.$next = null;
// will update stickyHeaders, just in case, see #912 // will update stickyHeaders, just in case, see #912
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
} }
}; };
@ -2787,7 +2789,7 @@
} }
// reset stickyHeader widths // reset stickyHeader widths
c.$table.trigger( 'stickyHeadersUpdate' ); c.$table.triggerHandler( 'stickyHeadersUpdate' );
if ( ts.storage && !refreshing ) { if ( ts.storage && !refreshing ) {
ts.storage( this, ts.css.resizableStorage, {} ); ts.storage( this, ts.css.resizableStorage, {} );
} }

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! Widget: alignChar - updated 2/7/2015 (v2.19.0) */ /*! Widget: alignChar - updated 2/7/2015 (v2.19.0) */
!function(a){"use strict";var b=a.tablesorter;b.alignChar={init:function(c,d,e){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){var f=a(this),g={column:this.column,align:f.attr(e.alignChar_charAttrib),alignIndex:parseInt(f.attr(e.alignChar_indexAttrib)||0,10),adjust:parseFloat(f.attr(e.alignChar_adjustAttrib))||0};g.regex=new RegExp("\\"+g.align,"g"),"undefined"!=typeof g.align&&(e.alignChar_savedVars[this.column]=g,b.alignChar.setup(c,d,e,g))})},setup:function(b,c,d,e){if(!a.isEmptyObject(c.cache)){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=[];for(f=0;f<c.$tbodies.length;f++)for(l=c.cache[f],o=l.normalized.length,g=0;o>g;g++){if(s=l.row?l.row[g]:l.normalized[g][c.columns].$row,m=s.find("td").eq(e.column).text().replace(/[ ]/g," "),n=(m.match(e.regex)||[]).length,n>0&&e.alignIndex>0)for(i=Math.min(e.alignIndex,n),h=0,k=0,j=0;h++<i;)j=m.indexOf(e.align,j+1),k=0>j?k:j;else k=m.indexOf(e.align);k>=0?(t.push(m.substring(0,k)||""),u.push(m.substring(k,m.length)||"")):(t.push(n>=1&&e.alignIndex>=n?"":m||""),u.push(n>=1&&e.alignIndex>=n?m||"":""))}for(p=a.extend([],t).sort(function(a,b){return b.length-a.length})[0],q=a.extend([],u).sort(function(a,b){return b.length-a.length})[0],e.width=e.width||Math.floor(p.length/(p.length+q.length)*100)+e.adjust,p="min-width:"+e.width+"%",q="min-width:"+(100-e.width)+"%",f=0;f<c.$tbodies.length;f++)for(l=c.cache[f],o=l.normalized.length,g=0;o>g;g++)r=a(d.alignChar_wrap).length?a(d.alignChar_wrap).html(e.align)[0].outerHTML:e.align,s=l.row?l.row[g]:l.normalized[g][c.columns].$row,j=u[g].slice(e.align.length),s.find("td").eq(e.column).html('<span class="ts-align-wrap"><span class="ts-align-left" style="'+p+'">'+t[g]+'</span><span class="ts-align-right" style="'+q+'">'+(j.length?r+j:"")+"</span></span>");d.alignChar_initialized=!0}},remove:function(b,c,d){if(!a.isEmptyObject(c.cache)){var e,f,g,h,i,j;for(e=0;e<c.$tbodies.length;e++)for(h=c.cache[e],g=h.normalized.length,f=0;g>f;f++)i=h.row?h.row[f]:h.normalized[f][c.columns].$row,j=i.find("td").eq(d),j.html(j.text().replace(/\s/g," "))}}},b.addWidget({id:"alignChar",priority:100,options:{alignChar_wrap:"",alignChar_charAttrib:"data-align-char",alignChar_indexAttrib:"data-align-index",alignChar_adjustAttrib:"data-align-adjust"},init:function(a,c,d,e){e.alignChar_initialized=!1,e.alignChar_savedVars=[],b.alignChar.init(a,d,e),d.$table.on("pagerEnd refreshAlign",function(){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,d,this.column)}),b.alignChar.init(a,d,e)})},format:function(a,b,c){c.alignChar_initialized||b.$table.trigger("refreshAlign")},remove:function(a,c,d,e){e||(c.$headers.filter("["+d.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,c,this.column)}),d.alignChar_initialized=!1)}})}(jQuery); !function(a){"use strict";var b=a.tablesorter;b.alignChar={init:function(c,d,e){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){var f=a(this),g={column:this.column,align:f.attr(e.alignChar_charAttrib),alignIndex:parseInt(f.attr(e.alignChar_indexAttrib)||0,10),adjust:parseFloat(f.attr(e.alignChar_adjustAttrib))||0};g.regex=new RegExp("\\"+g.align,"g"),"undefined"!=typeof g.align&&(e.alignChar_savedVars[this.column]=g,b.alignChar.setup(c,d,e,g))})},setup:function(b,c,d,e){if(!a.isEmptyObject(c.cache)){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=[];for(f=0;f<c.$tbodies.length;f++)for(l=c.cache[f],o=l.normalized.length,g=0;o>g;g++){if(s=l.row?l.row[g]:l.normalized[g][c.columns].$row,m=s.find("td").eq(e.column).text().replace(/[ ]/g," "),n=(m.match(e.regex)||[]).length,n>0&&e.alignIndex>0)for(i=Math.min(e.alignIndex,n),h=0,k=0,j=0;h++<i;)j=m.indexOf(e.align,j+1),k=0>j?k:j;else k=m.indexOf(e.align);k>=0?(t.push(m.substring(0,k)||""),u.push(m.substring(k,m.length)||"")):(t.push(n>=1&&e.alignIndex>=n?"":m||""),u.push(n>=1&&e.alignIndex>=n?m||"":""))}for(p=a.extend([],t).sort(function(a,b){return b.length-a.length})[0],q=a.extend([],u).sort(function(a,b){return b.length-a.length})[0],e.width=e.width||Math.floor(p.length/(p.length+q.length)*100)+e.adjust,p="min-width:"+e.width+"%",q="min-width:"+(100-e.width)+"%",f=0;f<c.$tbodies.length;f++)for(l=c.cache[f],o=l.normalized.length,g=0;o>g;g++)r=a(d.alignChar_wrap).length?a(d.alignChar_wrap).html(e.align)[0].outerHTML:e.align,s=l.row?l.row[g]:l.normalized[g][c.columns].$row,j=u[g].slice(e.align.length),s.find("td").eq(e.column).html('<span class="ts-align-wrap"><span class="ts-align-left" style="'+p+'">'+t[g]+'</span><span class="ts-align-right" style="'+q+'">'+(j.length?r+j:"")+"</span></span>");d.alignChar_initialized=!0}},remove:function(b,c,d){if(!a.isEmptyObject(c.cache)){var e,f,g,h,i,j;for(e=0;e<c.$tbodies.length;e++)for(h=c.cache[e],g=h.normalized.length,f=0;g>f;f++)i=h.row?h.row[f]:h.normalized[f][c.columns].$row,j=i.find("td").eq(d),j.html(j.text().replace(/\s/g," "))}}},b.addWidget({id:"alignChar",priority:100,options:{alignChar_wrap:"",alignChar_charAttrib:"data-align-char",alignChar_indexAttrib:"data-align-index",alignChar_adjustAttrib:"data-align-adjust"},init:function(a,c,d,e){e.alignChar_initialized=!1,e.alignChar_savedVars=[],b.alignChar.init(a,d,e),d.$table.on("pagerEnd refreshAlign",function(){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,d,this.column)}),b.alignChar.init(a,d,e)})},format:function(a,b,c){c.alignChar_initialized||b.$table.triggerHandler("refreshAlign")},remove:function(a,c,d,e){e||(c.$headers.filter("["+d.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,c,this.column)}),d.alignChar_initialized=!1)}})}(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! Widget: sort2Hash (BETA) - updated 11/10/2015 (v2.24.4) */ /*! Widget: sort2Hash (BETA) - updated 11/10/2015 (v2.24.4) */
!function(a){"use strict";var b=a.tablesorter||{},c=b.sort2Hash={init:function(d,e){var f,g,h,i,j=d.table,k=d.pager,l=b.hasWidget(j,"saveSort"),m=c.decodeHash(d,e,"sort");(m&&!l||m&&l&&e.sort2Hash_overrideSaveSort)&&c.convertString2Sort(d,e,m),b.hasWidget(d.table,"pager")&&(g=parseInt(c.decodeHash(d,e,"page"),10),h=k.page=0>g?0:g>k.totalPages?k.totalPages-1:g,i=k.size=parseInt(c.decodeHash(d,e,"size"),10)),b.hasWidget(j,"filter")&&(f=c.decodeHash(d,e,"filter"),f&&(f=f.split(e.sort2Hash_separator),d.$table.one("tablesorter-ready",function(){setTimeout(function(){d.$table.one("filterEnd",function(){a(this).trigger("pageAndSize",[h,i])}),a.tablesorter.setFilters(j,f,!0)},100)}))),f||d.$table.one("tablesorter-ready",function(){d.$table.trigger("pageAndSize",[h,i])}),d.$table.on("sortEnd.sort2hash filterEnd.sort2hash pagerComplete.sort2Hash",function(){this.hasInitialized&&c.setHash(this.config,this.config.widgetOptions)})},getTableId:function(b,c){return c.sort2Hash_tableId||b.table.id||"table"+a("table").index(b.$table)},regexEscape:function(a){return a.replace(/([\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|])/g,"\\$1")},convertString2Sort:function(a,b,d){for(var e,f,g,h,i,j,k=d.split(b.sort2Hash_separator),l=0,m=k.length,n=[];m>l;){if(f=k[l++],h=parseInt(f,10),isNaN(h)||h>a.columns)for(e=new RegExp("("+c.regexEscape(f)+")","i"),i=0;i<a.columns;i++)j=a.$headerIndexed[i],e.test(j.attr(b.sort2Hash_headerTextAttr))&&(f=i,i=a.columns);g=k[l++],"undefined"!=typeof f&&"undefined"!=typeof g&&(isNaN(g)&&(g=g.indexOf(b.sort2Hash_directionText[1])>-1?1:0),n.push([f,g]))}n.length&&(a.sortList=n)},convertSort2String:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],e=a.trim(b.$headerIndexed[f].attr(c.sort2Hash_headerTextAttr)),h.push(""!==e?encodeURIComponent(e):f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},convertFilter2String:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],e=a.trim(b.$headerIndexed[f].attr(c.sort2Hash_headerTextAttr)),f="undefined"!=typeof e?encodeURIComponent(e):f,h.push(f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},getParam:function(a,b,d){b||(b=window.location.hash);var e=new RegExp("[\\?&]"+c.regexEscape(a)+"=([^&#]*)"),f=e.exec(b);return d?e:null===f?"":decodeURIComponent(f[1])},removeParam:function(a,b){b||(b=window.location.hash);var d,e=c.getParam(a,b,!0),f=[],g=b.split("&"),h=g.length;for(d=0;h>d;d++)e.test("&"+g[d])||f.push(g[d]);return f.length?f.join("&"):""},encodeHash:function(a,b,d,e,f){var g=!1,h=c.getTableId(a,b);return"function"==typeof b.sort2Hash_encodeHash&&(g=b.sort2Hash_encodeHash(a,h,d,e,f||e)),g===!1&&(g="&"+d+"["+h+"]="+e),g},decodeHash:function(a,b,d){var e=!1,f=c.getTableId(a,b);return"function"==typeof b.sort2Hash_decodeHash&&(e=b.sort2Hash_decodeHash(a,f,d)),e===!1&&(e=c.getParam(d+"["+f+"]")),e||""},cleanHash:function(a,b,d,e){var f=!1,g=c.getTableId(a,b);return"function"==typeof b.sort2Hash_cleanHash&&(f=b.sort2Hash_cleanHash(a,g,d,e)),f===!1&&(f=c.removeParam(d+"["+g+"]",e)),f||""},setHash:function(d,e){var f="",g=window.location.hash,h=b.hasWidget(d.table,"pager"),i=b.hasWidget(d.table,"filter"),j=c.convertSort2String(d,e),k=i&&""!==d.lastSearch.join("")?d.lastSearch:[],l=encodeURIComponent(k.join(d.widgetOptions.sort2Hash_separator)),m={sort:j?c.encodeHash(d,e,"sort",j,d.sortList):"",page:h?c.encodeHash(d,e,"page",d.pager.page+1):"",size:h?c.encodeHash(d,e,"size",d.pager.size):"",filter:l?c.encodeHash(d,e,"filter",l,k):""};a.each(m,function(a,b){g=c.cleanHash(d,e,a,g),f+=b}),window.location.hash=((window.location.hash||"").replace("#","").length?g:e.sort2Hash_hash)+f}};b.addWidget({id:"sort2Hash",priority:60,options:{sort2Hash_hash:"#",sort2Hash_separator:"-",sort2Hash_headerTextAttr:"data-header",sort2Hash_directionText:[0,1],sort2Hash_overrideSaveSort:!1},init:function(a,b,d,e){c.init(d,e)},remove:function(a,b){b.$table.off(".sort2hash")}})}(jQuery); !function(a){"use strict";var b=a.tablesorter||{},c=b.sort2Hash={init:function(d,e){var f,g,h,i,j=d.table,k=d.pager,l=b.hasWidget(j,"saveSort"),m=c.decodeHash(d,e,"sort");(m&&!l||m&&l&&e.sort2Hash_overrideSaveSort)&&c.convertString2Sort(d,e,m),b.hasWidget(d.table,"pager")&&(g=parseInt(c.decodeHash(d,e,"page"),10),h=k.page=0>g?0:g>k.totalPages?k.totalPages-1:g,i=k.size=parseInt(c.decodeHash(d,e,"size"),10)),b.hasWidget(j,"filter")&&(f=c.decodeHash(d,e,"filter"),f&&(f=f.split(e.sort2Hash_separator),d.$table.one("tablesorter-ready",function(){setTimeout(function(){d.$table.one("filterEnd",function(){a(this).triggerHandler("pageAndSize",[h,i])}),a.tablesorter.setFilters(j,f,!0)},100)}))),f||d.$table.one("tablesorter-ready",function(){d.$table.triggerHandler("pageAndSize",[h,i])}),d.$table.on("sortEnd.sort2hash filterEnd.sort2hash pagerComplete.sort2Hash",function(){this.hasInitialized&&c.setHash(this.config,this.config.widgetOptions)})},getTableId:function(b,c){return c.sort2Hash_tableId||b.table.id||"table"+a("table").index(b.$table)},regexEscape:function(a){return a.replace(/([\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|])/g,"\\$1")},convertString2Sort:function(a,b,d){for(var e,f,g,h,i,j,k=d.split(b.sort2Hash_separator),l=0,m=k.length,n=[];m>l;){if(f=k[l++],h=parseInt(f,10),isNaN(h)||h>a.columns)for(e=new RegExp("("+c.regexEscape(f)+")","i"),i=0;i<a.columns;i++)j=a.$headerIndexed[i],e.test(j.attr(b.sort2Hash_headerTextAttr))&&(f=i,i=a.columns);g=k[l++],"undefined"!=typeof f&&"undefined"!=typeof g&&(isNaN(g)&&(g=g.indexOf(b.sort2Hash_directionText[1])>-1?1:0),n.push([f,g]))}n.length&&(a.sortList=n)},convertSort2String:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],e=a.trim(b.$headerIndexed[f].attr(c.sort2Hash_headerTextAttr)),h.push(""!==e?encodeURIComponent(e):f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},convertFilter2String:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],e=a.trim(b.$headerIndexed[f].attr(c.sort2Hash_headerTextAttr)),f="undefined"!=typeof e?encodeURIComponent(e):f,h.push(f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},getParam:function(a,b,d){b||(b=window.location.hash);var e=new RegExp("[\\?&]"+c.regexEscape(a)+"=([^&#]*)"),f=e.exec(b);return d?e:null===f?"":decodeURIComponent(f[1])},removeParam:function(a,b){b||(b=window.location.hash);var d,e=c.getParam(a,b,!0),f=[],g=b.split("&"),h=g.length;for(d=0;h>d;d++)e.test("&"+g[d])||f.push(g[d]);return f.length?f.join("&"):""},encodeHash:function(a,b,d,e,f){var g=!1,h=c.getTableId(a,b);return"function"==typeof b.sort2Hash_encodeHash&&(g=b.sort2Hash_encodeHash(a,h,d,e,f||e)),g===!1&&(g="&"+d+"["+h+"]="+e),g},decodeHash:function(a,b,d){var e=!1,f=c.getTableId(a,b);return"function"==typeof b.sort2Hash_decodeHash&&(e=b.sort2Hash_decodeHash(a,f,d)),e===!1&&(e=c.getParam(d+"["+f+"]")),e||""},cleanHash:function(a,b,d,e){var f=!1,g=c.getTableId(a,b);return"function"==typeof b.sort2Hash_cleanHash&&(f=b.sort2Hash_cleanHash(a,g,d,e)),f===!1&&(f=c.removeParam(d+"["+g+"]",e)),f||""},setHash:function(d,e){var f="",g=window.location.hash,h=b.hasWidget(d.table,"pager"),i=b.hasWidget(d.table,"filter"),j=c.convertSort2String(d,e),k=i&&""!==d.lastSearch.join("")?d.lastSearch:[],l=encodeURIComponent(k.join(d.widgetOptions.sort2Hash_separator)),m={sort:j?c.encodeHash(d,e,"sort",j,d.sortList):"",page:h?c.encodeHash(d,e,"page",d.pager.page+1):"",size:h?c.encodeHash(d,e,"size",d.pager.size):"",filter:l?c.encodeHash(d,e,"filter",l,k):""};a.each(m,function(a,b){g=c.cleanHash(d,e,a,g),f+=b}),window.location.hash=((window.location.hash||"").replace("#","").length?g:e.sort2Hash_hash)+f}};b.addWidget({id:"sort2Hash",priority:60,options:{sort2Hash_hash:"#",sort2Hash_separator:"-",sort2Hash_headerTextAttr:"data-header",sort2Hash_directionText:[0,1],sort2Hash_overrideSaveSort:!1},init:function(a,b,d,e){c.init(d,e)},remove:function(a,b){b.$table.off(".sort2hash")}})}(jQuery);

View File

@ -1,2 +1,2 @@
/*! widget: staticRow - updated 10/31/2015 (v2.24.0) */ /*! widget: staticRow - updated 10/31/2015 (v2.24.0) */
!function(a){"use strict";var b=a.tablesorter,c=function(b){var c,d,e,f,g,h=b.config;h&&(d=h.widgetOptions,h.$tbodies.each(function(){c=a(this).children(),g=c.length,c.filter(d.staticRow_class).each(function(){c=a(this),f=c.data(d.staticRow_index),"undefined"!=typeof f?(e=parseFloat(f),f=/%/.test(f)?Math.round(e/100*g):e):f=c.index(),c.data(d.staticRow_data,f)})}))};b.addWidget({id:"staticRow",options:{staticRow_class:".static",staticRow_data:"static-index",staticRow_index:"row-index",staticRow_event:"staticRowsRefresh"},init:function(a,d,e,f){c(a),e.$table.unbind(("updateComplete.tsstaticrows "+f.staticRow_event).replace(/\s+/g," ")).bind("updateComplete.tsstaticrows "+f.staticRow_event,function(){c(a),b.applyWidget(a)})},format:function(b,c,d){var e,f,g,h,i,j,k,l;c.$tbodies.each(function(){for(i=a.tablesorter.processTbody(b,a(this),!0),j=!0,g=0,k=i.children(d.staticRow_class),h=i.children("tr").length-1,l=k.length;j&&l>g;)j=!1,k.each(function(){e=a(this).data(d.staticRow_data),e=e>=h?h:0>e?0:e,e!==a(this).index()&&(j=!0,f=a(this).detach(),e>=h?f.appendTo(i):0===e?f.prependTo(i):f.insertBefore(i.find("tr:eq("+e+")")))}),g++;a.tablesorter.processTbody(b,i,!1)}),c.$table.trigger("staticRowsComplete",b)},remove:function(a,b,c){b.$table.unbind(("updateComplete.tsstaticrows "+c.staticRow_event).replace(/\s+/g," "))}})}(jQuery); !function(a){"use strict";var b=a.tablesorter,c=function(b){var c,d,e,f,g,h=b.config;h&&(d=h.widgetOptions,h.$tbodies.each(function(){c=a(this).children(),g=c.length,c.filter(d.staticRow_class).each(function(){c=a(this),f=c.data(d.staticRow_index),"undefined"!=typeof f?(e=parseFloat(f),f=/%/.test(f)?Math.round(e/100*g):e):f=c.index(),c.data(d.staticRow_data,f)})}))};b.addWidget({id:"staticRow",options:{staticRow_class:".static",staticRow_data:"static-index",staticRow_index:"row-index",staticRow_event:"staticRowsRefresh"},init:function(a,d,e,f){c(a),e.$table.unbind(("updateComplete.tsstaticrows "+f.staticRow_event).replace(/\s+/g," ")).bind("updateComplete.tsstaticrows "+f.staticRow_event,function(){c(a),b.applyWidget(a)})},format:function(b,c,d){var e,f,g,h,i,j,k,l;c.$tbodies.each(function(){for(i=a.tablesorter.processTbody(b,a(this),!0),j=!0,g=0,k=i.children(d.staticRow_class),h=i.children("tr").length-1,l=k.length;j&&l>g;)j=!1,k.each(function(){e=a(this).data(d.staticRow_data),e=e>=h?h:0>e?0:e,e!==a(this).index()&&(j=!0,f=a(this).detach(),e>=h?f.appendTo(i):0===e?f.prependTo(i):f.insertBefore(i.find("tr:eq("+e+")")))}),g++;a.tablesorter.processTbody(b,i,!1)}),c.$table.triggerHandler("staticRowsComplete",b)},remove:function(a,b,c){b.$table.unbind(("updateComplete.tsstaticrows "+c.staticRow_event).replace(/\s+/g," "))}})}(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
!function(a){"use strict";var b,c,d,e=a.tablesorter,f=!1,g=e.view={copyCaption:function(b,c){g.removeCaption(b,c),b.$table.find("caption").length>0&&a(c.view_caption).text(b.$table.find("caption").text())},removeCaption:function(b,c){a(c.view_caption).empty()},buildToolBar:function(b,c){g.removeToolBar(b,c),g.copyCaption(b,c);var d=a(c.view_toolbar);a.each(c.view_layouts,function(b,e){var f=c.view_switcher_class;b==c.view_layout&&(f+=" active");var g=a("<a>",{href:"#","class":f,"data-view-type":b,title:e.title});g.append(a("<i>",{"class":e.icon})),d.append(g)}),d.find("."+c.view_switcher_class).on("click",function(e){return e.preventDefault(),a(this).hasClass("active")?!1:(d.find("."+c.view_switcher_class).removeClass("active"),a(this).addClass("active"),c.view_layout=a(this).attr("data-view-type"),c.view_layouts[c.view_layout].raw===!0?(g.remove(b,c),g.buildToolBar(b,c)):(f===!1&&g.hideTable(b,c),g.buildView(b,c)),void 0)})},removeToolBar:function(b,c){a(c.view_toolbar).empty(),g.removeCaption(b,c)},buildView:function(b,c){g.removeView(b,c);var d=c.view_layouts[c.view_layout],f=a(d.container,{"class":c.view_layout});e.getColumnText(b.$table,0,function(b){var c=d.tmpl;a.each(a(b.$row).find("td"),function(b,d){var e={},f="{col"+b+"}";a.each(d.attributes,function(a,b){e[b.nodeName]=b.nodeValue});var g=a(d).html(),h=a("<span />").append(a("<span/>",e).append(g));c=c.replace(f,h.html())});var e=a(c);a.each(b.$row[0].attributes,function(a,b){"class"==b.nodeName?e.attr(b.nodeName,e.attr(b.nodeName)+" "+b.nodeValue):e.attr(b.nodeName,b.nodeValue)}),f.append(e)}),a(c.view_container).append(f)},removeView:function(b,c){a(c.view_container).empty()},hideTable:function(a,e){b=a.$table.css("position"),c=a.$table.css("bottom"),d=a.$table.css("left"),a.$table.css({position:"absolute",top:"-10000px",left:"-10000px"}),f=!0},init:function(b,c){c.view_layout!==!1&&"undefined"!=typeof c.view_layouts[c.view_layout]&&(f===!1&&g.hideTable(b,c),a(b.$table).on("tablesorter-ready",function(){g.buildToolBar(b,c),g.buildView(b,c),a(b.$table).trigger("viewComplete")}))},remove:function(a,e){g.removeToolBar(a,e),g.removeView(a,e),a.$table.css({position:b,top:c,left:d}),f=!1}};e.addWidget({id:"view",options:{view_toolbar:"#ts-view-toolbar",view_container:"#ts-view",view_caption:"#ts-view-caption",view_switcher_class:"ts-view-switcher",view_layout:!1,view_layouts:{}},init:function(a,b,c,d){g.init(c,d)},remove:function(a,b,c){g.remove(b,c)}})}(jQuery); !function(a){"use strict";var b,c,d,e=a.tablesorter,f=!1,g=e.view={copyCaption:function(b,c){g.removeCaption(b,c),b.$table.find("caption").length>0&&a(c.view_caption).text(b.$table.find("caption").text())},removeCaption:function(b,c){a(c.view_caption).empty()},buildToolBar:function(b,c){g.removeToolBar(b,c),g.copyCaption(b,c);var d=a(c.view_toolbar);a.each(c.view_layouts,function(b,e){var f=c.view_switcher_class;b==c.view_layout&&(f+=" active");var g=a("<a>",{href:"#","class":f,"data-view-type":b,title:e.title});g.append(a("<i>",{"class":e.icon})),d.append(g)}),d.find("."+c.view_switcher_class).on("click",function(e){return e.preventDefault(),a(this).hasClass("active")?!1:(d.find("."+c.view_switcher_class).removeClass("active"),a(this).addClass("active"),c.view_layout=a(this).attr("data-view-type"),c.view_layouts[c.view_layout].raw===!0?(g.remove(b,c),g.buildToolBar(b,c)):(f===!1&&g.hideTable(b,c),g.buildView(b,c)),void 0)})},removeToolBar:function(b,c){a(c.view_toolbar).empty(),g.removeCaption(b,c)},buildView:function(b,c){g.removeView(b,c);var d=c.view_layouts[c.view_layout],f=a(d.container,{"class":c.view_layout});e.getColumnText(b.$table,0,function(b){var c=d.tmpl;a.each(a(b.$row).find("td"),function(b,d){var e={},f="{col"+b+"}";a.each(d.attributes,function(a,b){e[b.nodeName]=b.nodeValue});var g=a(d).html(),h=a("<span />").append(a("<span/>",e).append(g));c=c.replace(f,h.html())});var e=a(c);a.each(b.$row[0].attributes,function(a,b){"class"==b.nodeName?e.attr(b.nodeName,e.attr(b.nodeName)+" "+b.nodeValue):e.attr(b.nodeName,b.nodeValue)}),f.append(e)}),a(c.view_container).append(f)},removeView:function(b,c){a(c.view_container).empty()},hideTable:function(a,e){b=a.$table.css("position"),c=a.$table.css("bottom"),d=a.$table.css("left"),a.$table.css({position:"absolute",top:"-10000px",left:"-10000px"}),f=!0},init:function(a,b){b.view_layout!==!1&&"undefined"!=typeof b.view_layouts[b.view_layout]&&(f===!1&&g.hideTable(a,b),a.$table.on("tablesorter-ready",function(){g.buildToolBar(a,b),g.buildView(a,b),a.$table.triggerHandler("viewComplete")}))},remove:function(a,e){g.removeToolBar(a,e),g.removeView(a,e),a.$table.css({position:b,top:c,left:d}),f=!1}};e.addWidget({id:"view",options:{view_toolbar:"#ts-view-toolbar",view_container:"#ts-view",view_caption:"#ts-view-caption",view_switcher_class:"ts-view-switcher",view_layout:!1,view_layouts:{}},init:function(a,b,c,d){g.init(c,d)},remove:function(a,b,c){g.remove(b,c)}})}(jQuery);

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/ /*! tablesorter (FORK) - updated 12-01-2015 (v2.24.6)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -350,7 +350,7 @@
console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) ); console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
if ( c.debug && console.groupEnd ) { console.groupEnd(); } if ( c.debug && console.groupEnd ) { console.groupEnd(); }
} }
$table.trigger( 'tablesorter-initialized', table ); $table.triggerHandler( 'tablesorter-initialized', table );
if ( typeof c.initialized === 'function' ) { if ( typeof c.initialized === 'function' ) {
c.initialized( table ); c.initialized( table );
} }
@ -957,7 +957,20 @@
ts.isProcessing( table ); // remove processing icon ts.isProcessing( table ); // remove processing icon
} }
if ( c.debug ) { if ( c.debug ) {
console.log( 'Building cache for ' + totalRows + ' rows' + ts.benchmark( cacheTime ) ); len = Math.min( 5, c.totalRows );
console[ console.group ? 'group' : 'log' ]( 'Building cache for ' + totalRows +
' rows (showing ' + len + ' rows)' + ts.benchmark( cacheTime ) );
val = {};
for ( colIndex = 0; colIndex < c.columns; colIndex++ ) {
for ( cacheIndex = 0; cacheIndex < len; cacheIndex++ ) {
if ( !val[ 'row: ' + cacheIndex ] ) {
val[ 'row: ' + cacheIndex ] = {};
}
val[ 'row: ' + cacheIndex ][ c.headerContent[ colIndex ] ] = cache.normalized[ cacheIndex ][ colIndex ];
}
}
console[ console.table ? 'table' : 'log' ]( val );
if ( console.groupEnd ) { console.groupEnd(); }
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1364,7 +1377,7 @@
if ( ts.isEmptyObject( cache ) ) { if ( ts.isEmptyObject( cache ) ) {
// run pager appender in case the table was just emptied // run pager appender in case the table was just emptied
return c.appender ? c.appender( table, rows ) : return c.appender ? c.appender( table, rows ) :
table.isUpdating ? c.$table.trigger( 'updateComplete', table ) : ''; // Fixes #532 table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
} }
if ( c.debug ) { if ( c.debug ) {
appendTime = new Date(); appendTime = new Date();
@ -1398,7 +1411,7 @@
ts.applyWidget( table ); ts.applyWidget( table );
} }
if ( table.isUpdating ) { if ( table.isUpdating ) {
c.$table.trigger( 'updateComplete', table ); c.$table.triggerHandler( 'updateComplete', table );
} }
}, },
@ -1434,7 +1447,7 @@
order = c.sortVars[ col ].order; order = c.sortVars[ col ].order;
// Only call sortStart if sorting is enabled // Only call sortStart if sorting is enabled
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// get current column sort order // get current column sort order
c.sortVars[ col ].count = c.sortVars[ col ].count =
event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 ); event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
@ -1545,14 +1558,14 @@
} }
} }
// sortBegin event triggered immediately before the sort // sortBegin event triggered immediately before the sort
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// setTimeout needed so the processing icon shows up // setTimeout needed so the processing icon shows up
setTimeout( function() { setTimeout( function() {
// set css for headers // set css for headers
ts.setHeadersCss( c ); ts.setHeadersCss( c );
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c ); ts.appendCache( c );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
}, 1 ); }, 1 );
}, },
@ -1628,7 +1641,7 @@
resortComplete : function( c, callback ) { resortComplete : function( c, callback ) {
if ( c.table.isUpdating ) { if ( c.table.isUpdating ) {
c.$table.trigger( 'updateComplete', c.table ); c.$table.triggerHandler( 'updateComplete', c.table );
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( c.table ); callback( c.table );
@ -1660,7 +1673,7 @@
sortOn : function( c, list, callback, init ) { sortOn : function( c, list, callback, init ) {
var table = c.table; var table = c.table;
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// update header count index // update header count index
ts.updateHeaderSortCount( c, list ); ts.updateHeaderSortCount( c, list );
// set css for headers // set css for headers
@ -1669,11 +1682,11 @@
if ( c.delayInit && ts.isEmptyObject( c.cache ) ) { if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
ts.buildCache( c ); ts.buildCache( c );
} }
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// sort the table and append it to the dom // sort the table and append it to the dom
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c, init ); ts.appendCache( c, init );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
ts.applyWidget( table ); ts.applyWidget( table );
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1939,7 +1952,7 @@
c.timerReady = setTimeout( function() { c.timerReady = setTimeout( function() {
table.isApplyingWidgets = false; table.isApplyingWidgets = false;
$.data( table, 'lastWidgetApplication', new Date() ); $.data( table, 'lastWidgetApplication', new Date() );
c.$table.trigger( 'tablesorter-ready' ); c.$table.triggerHandler( 'tablesorter-ready' );
}, 10 ); }, 10 );
if ( c.debug ) { if ( c.debug ) {
widget = c.widgets.length; widget = c.widgets.length;
@ -1995,7 +2008,7 @@
len = widgets.length, len = widgets.length,
list = [], list = [],
callback = function( table ) { callback = function( table ) {
$( table ).trigger( 'refreshComplete' ); $( table ).triggerHandler( 'refreshComplete' );
}; };
// remove widgets not defined in config.widgets, unless doAll is true // remove widgets not defined in config.widgets, unless doAll is true
for ( indx = 0; indx < len; indx++ ) { for ( indx = 0; indx < len; indx++ ) {
@ -2320,8 +2333,8 @@
$f = $t.find( 'tfoot:first > tr' ).children( 'th, td' ); $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) { if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) {
// reapply uitheme classes, in case we want to maintain appearance // reapply uitheme classes, in case we want to maintain appearance
$t.trigger( 'applyWidgetId', [ 'uitheme' ] ); $t.triggerHandler( 'applyWidgetId', [ 'uitheme' ] );
$t.trigger( 'applyWidgetId', [ 'zebra' ] ); $t.triggerHandler( 'applyWidgetId', [ 'zebra' ] );
} }
// remove widget added rows, just in case // remove widget added rows, just in case
$h.find( 'tr' ).not( $r ).remove(); $h.find( 'tr' ).not( $r ).remove();
@ -3437,7 +3450,7 @@
if ( wo.filter_reset instanceof $ ) { if ( wo.filter_reset instanceof $ ) {
// reset contains a jQuery object, bind to it // reset contains a jQuery object, bind to it
wo.filter_reset.click( function() { wo.filter_reset.click( function() {
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} else if ( $( wo.filter_reset ).length ) { } else if ( $( wo.filter_reset ).length ) {
// reset is a jQuery selector, use event delegation // reset is a jQuery selector, use event delegation
@ -3445,7 +3458,7 @@
.undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' ) .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
.delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() { .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
// trigger a reset event, so other functions ( filter_formatter ) know when to reset // trigger a reset event, so other functions ( filter_formatter ) know when to reset
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} }
} }
@ -3547,7 +3560,7 @@
ts.setFilters( table, filters, true ); ts.setFilters( table, filters, true );
} }
} }
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout( function() { setTimeout( function() {
if ( !wo.filter_initialized ) { if ( !wo.filter_initialized ) {
@ -3557,7 +3570,7 @@
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if ( c.pager && c.pager.initialized && !wo.filter_initialized ) { if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
setTimeout( function() { setTimeout( function() {
tsf.filterInitComplete( c ); tsf.filterInitComplete( c );
}, 100 ); }, 100 );
@ -3580,7 +3593,7 @@
count = 0, count = 0,
completed = function() { completed = function() {
wo.filter_initialized = true; wo.filter_initialized = true;
c.$table.trigger( 'filterInit', c ); c.$table.triggerHandler( 'filterInit', c );
tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] ); tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] );
}; };
if ( $.isEmptyObject( wo.filter_formatter ) ) { if ( $.isEmptyObject( wo.filter_formatter ) ) {
@ -3828,7 +3841,7 @@
// show/hide filter row as needed // show/hide filter row as needed
c.$table c.$table
.find( '.' + tscss.filterRow ) .find( '.' + tscss.filterRow )
.trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' ); .triggerHandler( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
@ -3839,6 +3852,8 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
} }
// define filter inside it is false
filters = filters || [];
// convert filters to strings - see #1070 // convert filters to strings - see #1070
filters = Array.prototype.map ? filters = Array.prototype.map ?
filters.map( String ) : filters.map( String ) :
@ -3846,7 +3861,7 @@
filters.join( '\u0000' ).split( '\u0000' ); filters.join( '\u0000' ).split( '\u0000' );
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterStart', [ filters ] ); c.$table.triggerHandler( 'filterStart', [ filters ] );
} }
if ( c.showProcessing ) { if ( c.showProcessing ) {
// give it time for the processing icon to kick in // give it time for the processing icon to kick in
@ -4382,7 +4397,7 @@
console.log( 'Completed filter widget search' + ts.benchmark(time) ); console.log( 'Completed filter widget search' + ts.benchmark(time) );
} }
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterEnd', c ); c.$table.triggerHandler( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
ts.applyWidget( c.table ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
@ -4747,7 +4762,7 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
tsf.searching( c.table, filter, skipFirst ); tsf.searching( c.table, filter, skipFirst );
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
} }
return !!valid; return !!valid;
}; };
@ -4795,7 +4810,7 @@
} }
} }
if ( headers.length && triggerEvent !== false ) { if ( headers.length && triggerEvent !== false ) {
c.$table.trigger( 'resize', [ headers ] ); c.$table.triggerHandler( 'resize', [ headers ] );
} }
wo.resize_flag = false; wo.resize_flag = false;
}; };
@ -5022,7 +5037,7 @@
} }
} }
$table.trigger('stickyHeadersInit'); $table.triggerHandler('stickyHeadersInit');
}, },
remove: function(table, c, wo) { remove: function(table, c, wo) {
@ -5350,7 +5365,7 @@
} }
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
// dynamically update sticky header widths // dynamically update sticky header widths
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
}, },
stopResize : function( c, wo ) { stopResize : function( c, wo ) {
@ -5364,7 +5379,7 @@
vars.mouseXPosition = 0; vars.mouseXPosition = 0;
vars.$target = vars.$next = null; vars.$target = vars.$next = null;
// will update stickyHeaders, just in case, see #912 // will update stickyHeaders, just in case, see #912
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
} }
}; };
@ -5426,7 +5441,7 @@
} }
// reset stickyHeader widths // reset stickyHeader widths
c.$table.trigger( 'stickyHeadersUpdate' ); c.$table.triggerHandler( 'stickyHeadersUpdate' );
if ( ts.storage && !refreshing ) { if ( ts.storage && !refreshing ) {
ts.storage( this, ts.css.resizableStorage, {} ); ts.storage( this, ts.css.resizableStorage, {} );
} }

View File

@ -332,7 +332,7 @@
console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) ); console.log( 'Overall initialization time: ' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
if ( c.debug && console.groupEnd ) { console.groupEnd(); } if ( c.debug && console.groupEnd ) { console.groupEnd(); }
} }
$table.trigger( 'tablesorter-initialized', table ); $table.triggerHandler( 'tablesorter-initialized', table );
if ( typeof c.initialized === 'function' ) { if ( typeof c.initialized === 'function' ) {
c.initialized( table ); c.initialized( table );
} }
@ -1359,7 +1359,7 @@
if ( ts.isEmptyObject( cache ) ) { if ( ts.isEmptyObject( cache ) ) {
// run pager appender in case the table was just emptied // run pager appender in case the table was just emptied
return c.appender ? c.appender( table, rows ) : return c.appender ? c.appender( table, rows ) :
table.isUpdating ? c.$table.trigger( 'updateComplete', table ) : ''; // Fixes #532 table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
} }
if ( c.debug ) { if ( c.debug ) {
appendTime = new Date(); appendTime = new Date();
@ -1393,7 +1393,7 @@
ts.applyWidget( table ); ts.applyWidget( table );
} }
if ( table.isUpdating ) { if ( table.isUpdating ) {
c.$table.trigger( 'updateComplete', table ); c.$table.triggerHandler( 'updateComplete', table );
} }
}, },
@ -1429,7 +1429,7 @@
order = c.sortVars[ col ].order; order = c.sortVars[ col ].order;
// Only call sortStart if sorting is enabled // Only call sortStart if sorting is enabled
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// get current column sort order // get current column sort order
c.sortVars[ col ].count = c.sortVars[ col ].count =
event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 ); event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
@ -1540,14 +1540,14 @@
} }
} }
// sortBegin event triggered immediately before the sort // sortBegin event triggered immediately before the sort
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// setTimeout needed so the processing icon shows up // setTimeout needed so the processing icon shows up
setTimeout( function() { setTimeout( function() {
// set css for headers // set css for headers
ts.setHeadersCss( c ); ts.setHeadersCss( c );
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c ); ts.appendCache( c );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
}, 1 ); }, 1 );
}, },
@ -1623,7 +1623,7 @@
resortComplete : function( c, callback ) { resortComplete : function( c, callback ) {
if ( c.table.isUpdating ) { if ( c.table.isUpdating ) {
c.$table.trigger( 'updateComplete', c.table ); c.$table.triggerHandler( 'updateComplete', c.table );
} }
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( c.table ); callback( c.table );
@ -1655,7 +1655,7 @@
sortOn : function( c, list, callback, init ) { sortOn : function( c, list, callback, init ) {
var table = c.table; var table = c.table;
c.$table.trigger( 'sortStart', table ); c.$table.triggerHandler( 'sortStart', table );
// update header count index // update header count index
ts.updateHeaderSortCount( c, list ); ts.updateHeaderSortCount( c, list );
// set css for headers // set css for headers
@ -1664,11 +1664,11 @@
if ( c.delayInit && ts.isEmptyObject( c.cache ) ) { if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
ts.buildCache( c ); ts.buildCache( c );
} }
c.$table.trigger( 'sortBegin', table ); c.$table.triggerHandler( 'sortBegin', table );
// sort the table and append it to the dom // sort the table and append it to the dom
ts.multisort( c ); ts.multisort( c );
ts.appendCache( c, init ); ts.appendCache( c, init );
c.$table.trigger( 'sortEnd', table ); c.$table.triggerHandler( 'sortEnd', table );
ts.applyWidget( table ); ts.applyWidget( table );
if ( $.isFunction( callback ) ) { if ( $.isFunction( callback ) ) {
callback( table ); callback( table );
@ -1934,7 +1934,7 @@
c.timerReady = setTimeout( function() { c.timerReady = setTimeout( function() {
table.isApplyingWidgets = false; table.isApplyingWidgets = false;
$.data( table, 'lastWidgetApplication', new Date() ); $.data( table, 'lastWidgetApplication', new Date() );
c.$table.trigger( 'tablesorter-ready' ); c.$table.triggerHandler( 'tablesorter-ready' );
}, 10 ); }, 10 );
if ( c.debug ) { if ( c.debug ) {
widget = c.widgets.length; widget = c.widgets.length;
@ -1990,7 +1990,7 @@
len = widgets.length, len = widgets.length,
list = [], list = [],
callback = function( table ) { callback = function( table ) {
$( table ).trigger( 'refreshComplete' ); $( table ).triggerHandler( 'refreshComplete' );
}; };
// remove widgets not defined in config.widgets, unless doAll is true // remove widgets not defined in config.widgets, unless doAll is true
for ( indx = 0; indx < len; indx++ ) { for ( indx = 0; indx < len; indx++ ) {
@ -2315,8 +2315,8 @@
$f = $t.find( 'tfoot:first > tr' ).children( 'th, td' ); $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) { if ( removeClasses === false && $.inArray( 'uitheme', c.widgets ) >= 0 ) {
// reapply uitheme classes, in case we want to maintain appearance // reapply uitheme classes, in case we want to maintain appearance
$t.trigger( 'applyWidgetId', [ 'uitheme' ] ); $t.triggerHandler( 'applyWidgetId', [ 'uitheme' ] );
$t.trigger( 'applyWidgetId', [ 'zebra' ] ); $t.triggerHandler( 'applyWidgetId', [ 'zebra' ] );
} }
// remove widget added rows, just in case // remove widget added rows, just in case
$h.find( 'tr' ).not( $r ).remove(); $h.find( 'tr' ).not( $r ).remove();

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/ /*! tablesorter (FORK) - updated 12-01-2015 (v2.24.6)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -804,7 +804,7 @@
if ( wo.filter_reset instanceof $ ) { if ( wo.filter_reset instanceof $ ) {
// reset contains a jQuery object, bind to it // reset contains a jQuery object, bind to it
wo.filter_reset.click( function() { wo.filter_reset.click( function() {
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} else if ( $( wo.filter_reset ).length ) { } else if ( $( wo.filter_reset ).length ) {
// reset is a jQuery selector, use event delegation // reset is a jQuery selector, use event delegation
@ -812,7 +812,7 @@
.undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' ) .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
.delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() { .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
// trigger a reset event, so other functions ( filter_formatter ) know when to reset // trigger a reset event, so other functions ( filter_formatter ) know when to reset
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} }
} }
@ -914,7 +914,7 @@
ts.setFilters( table, filters, true ); ts.setFilters( table, filters, true );
} }
} }
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout( function() { setTimeout( function() {
if ( !wo.filter_initialized ) { if ( !wo.filter_initialized ) {
@ -924,7 +924,7 @@
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if ( c.pager && c.pager.initialized && !wo.filter_initialized ) { if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
setTimeout( function() { setTimeout( function() {
tsf.filterInitComplete( c ); tsf.filterInitComplete( c );
}, 100 ); }, 100 );
@ -947,7 +947,7 @@
count = 0, count = 0,
completed = function() { completed = function() {
wo.filter_initialized = true; wo.filter_initialized = true;
c.$table.trigger( 'filterInit', c ); c.$table.triggerHandler( 'filterInit', c );
tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] ); tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] );
}; };
if ( $.isEmptyObject( wo.filter_formatter ) ) { if ( $.isEmptyObject( wo.filter_formatter ) ) {
@ -1195,7 +1195,7 @@
// show/hide filter row as needed // show/hide filter row as needed
c.$table c.$table
.find( '.' + tscss.filterRow ) .find( '.' + tscss.filterRow )
.trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' ); .triggerHandler( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
@ -1206,6 +1206,8 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
} }
// define filter inside it is false
filters = filters || [];
// convert filters to strings - see #1070 // convert filters to strings - see #1070
filters = Array.prototype.map ? filters = Array.prototype.map ?
filters.map( String ) : filters.map( String ) :
@ -1213,7 +1215,7 @@
filters.join( '\u0000' ).split( '\u0000' ); filters.join( '\u0000' ).split( '\u0000' );
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterStart', [ filters ] ); c.$table.triggerHandler( 'filterStart', [ filters ] );
} }
if ( c.showProcessing ) { if ( c.showProcessing ) {
// give it time for the processing icon to kick in // give it time for the processing icon to kick in
@ -1749,7 +1751,7 @@
console.log( 'Completed filter widget search' + ts.benchmark(time) ); console.log( 'Completed filter widget search' + ts.benchmark(time) );
} }
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterEnd', c ); c.$table.triggerHandler( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
ts.applyWidget( c.table ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
@ -2114,7 +2116,7 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
tsf.searching( c.table, filter, skipFirst ); tsf.searching( c.table, filter, skipFirst );
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
} }
return !!valid; return !!valid;
}; };
@ -2162,7 +2164,7 @@
} }
} }
if ( headers.length && triggerEvent !== false ) { if ( headers.length && triggerEvent !== false ) {
c.$table.trigger( 'resize', [ headers ] ); c.$table.triggerHandler( 'resize', [ headers ] );
} }
wo.resize_flag = false; wo.resize_flag = false;
}; };
@ -2389,7 +2391,7 @@
} }
} }
$table.trigger('stickyHeadersInit'); $table.triggerHandler('stickyHeadersInit');
}, },
remove: function(table, c, wo) { remove: function(table, c, wo) {
@ -2717,7 +2719,7 @@
} }
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
// dynamically update sticky header widths // dynamically update sticky header widths
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
}, },
stopResize : function( c, wo ) { stopResize : function( c, wo ) {
@ -2731,7 +2733,7 @@
vars.mouseXPosition = 0; vars.mouseXPosition = 0;
vars.$target = vars.$next = null; vars.$target = vars.$next = null;
// will update stickyHeaders, just in case, see #912 // will update stickyHeaders, just in case, see #912
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
} }
}; };
@ -2793,7 +2795,7 @@
} }
// reset stickyHeader widths // reset stickyHeader widths
c.$table.trigger( 'stickyHeadersUpdate' ); c.$table.triggerHandler( 'stickyHeadersUpdate' );
if ( ts.storage && !refreshing ) { if ( ts.storage && !refreshing ) {
ts.storage( this, ts.css.resizableStorage, {} ); ts.storage( this, ts.css.resizableStorage, {} );
} }

View File

@ -132,7 +132,7 @@
format : function(table, c, wo){ format : function(table, c, wo){
// reinitialize in case table is empty when first initialized // reinitialize in case table is empty when first initialized
if (!wo.alignChar_initialized) { if (!wo.alignChar_initialized) {
c.$table.trigger('refreshAlign'); c.$table.triggerHandler('refreshAlign');
} }
}, },
remove : function(table, c, wo, refreshing){ remove : function(table, c, wo, refreshing){

View File

@ -192,7 +192,7 @@
}; };
bt.buildComplete = function(table, wo){ bt.buildComplete = function(table, wo){
$(table).trigger(wo.build_complete); $(table).triggerHandler(wo.build_complete);
ts.setup(table, table.config); ts.setup(table, table.config);
}; };

View File

@ -230,7 +230,7 @@
tsColSel.adjustColspans( c, wo ); tsColSel.adjustColspans( c, wo );
// trigger columnUpdate if auto is true (it gets skipped in updateCols() // trigger columnUpdate if auto is true (it gets skipped in updateCols()
if (colSel.auto) { if (colSel.auto) {
c.$table.trigger(wo.columnSelector_updated); c.$table.triggerHandler(wo.columnSelector_updated);
} }
}, },
addSelectors: function( prefix, column ) { addSelectors: function( prefix, column ) {
@ -318,7 +318,7 @@
ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states ); ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states );
} }
tsColSel.adjustColspans( c, wo ); tsColSel.adjustColspans( c, wo );
c.$table.trigger(wo.columnSelector_updated); c.$table.triggerHandler(wo.columnSelector_updated);
}, },
setUpColspan: function(c, wo) { setUpColspan: function(c, wo) {

View File

@ -430,7 +430,7 @@
if ( wo.filter_reset instanceof $ ) { if ( wo.filter_reset instanceof $ ) {
// reset contains a jQuery object, bind to it // reset contains a jQuery object, bind to it
wo.filter_reset.click( function() { wo.filter_reset.click( function() {
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} else if ( $( wo.filter_reset ).length ) { } else if ( $( wo.filter_reset ).length ) {
// reset is a jQuery selector, use event delegation // reset is a jQuery selector, use event delegation
@ -438,7 +438,7 @@
.undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' ) .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
.delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() { .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
// trigger a reset event, so other functions ( filter_formatter ) know when to reset // trigger a reset event, so other functions ( filter_formatter ) know when to reset
c.$table.trigger( 'filterReset' ); c.$table.triggerHandler( 'filterReset' );
}); });
} }
} }
@ -540,7 +540,7 @@
ts.setFilters( table, filters, true ); ts.setFilters( table, filters, true );
} }
} }
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout( function() { setTimeout( function() {
if ( !wo.filter_initialized ) { if ( !wo.filter_initialized ) {
@ -550,7 +550,7 @@
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if ( c.pager && c.pager.initialized && !wo.filter_initialized ) { if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
setTimeout( function() { setTimeout( function() {
tsf.filterInitComplete( c ); tsf.filterInitComplete( c );
}, 100 ); }, 100 );
@ -573,7 +573,7 @@
count = 0, count = 0,
completed = function() { completed = function() {
wo.filter_initialized = true; wo.filter_initialized = true;
c.$table.trigger( 'filterInit', c ); c.$table.triggerHandler( 'filterInit', c );
tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] ); tsf.findRows( c.table, c.$table.data( 'lastSearch' ) || [] );
}; };
if ( $.isEmptyObject( wo.filter_formatter ) ) { if ( $.isEmptyObject( wo.filter_formatter ) ) {
@ -821,7 +821,7 @@
// show/hide filter row as needed // show/hide filter row as needed
c.$table c.$table
.find( '.' + tscss.filterRow ) .find( '.' + tscss.filterRow )
.trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' ); .triggerHandler( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
@ -841,7 +841,7 @@
filters.join( '\u0000' ).split( '\u0000' ); filters.join( '\u0000' ).split( '\u0000' );
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterStart', [ filters ] ); c.$table.triggerHandler( 'filterStart', [ filters ] );
} }
if ( c.showProcessing ) { if ( c.showProcessing ) {
// give it time for the processing icon to kick in // give it time for the processing icon to kick in
@ -1377,7 +1377,7 @@
console.log( 'Completed filter widget search' + ts.benchmark(time) ); console.log( 'Completed filter widget search' + ts.benchmark(time) );
} }
if ( wo.filter_initialized ) { if ( wo.filter_initialized ) {
c.$table.trigger( 'filterEnd', c ); c.$table.triggerHandler( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
ts.applyWidget( c.table ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
@ -1742,7 +1742,7 @@
c.lastCombinedFilter = null; c.lastCombinedFilter = null;
c.lastSearch = []; c.lastSearch = [];
tsf.searching( c.table, filter, skipFirst ); tsf.searching( c.table, filter, skipFirst );
c.$table.trigger( 'filterFomatterUpdate' ); c.$table.triggerHandler( 'filterFomatterUpdate' );
} }
return !!valid; return !!valid;
}; };

View File

@ -123,7 +123,7 @@
tsg.findColumnGroups( c, wo, data ); tsg.findColumnGroups( c, wo, data );
tsg.processHeaders( c, wo, data ); tsg.processHeaders( c, wo, data );
c.$table.trigger(wo.group_complete); c.$table.triggerHandler(wo.group_complete);
} }
}, },

View File

@ -193,7 +193,7 @@
// clear initialized flag // clear initialized flag
p.initialized = false; p.initialized = false;
// before initialization event // before initialization event
c.$table.trigger( 'pagerBeforeInitialized', c ); c.$table.triggerHandler( 'pagerBeforeInitialized', c );
tsp.enablePager( c, false ); tsp.enablePager( c, false );
@ -232,7 +232,7 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering pagerInitialized' ); console.log( 'Pager: Triggering pagerInitialized' );
} }
c.$table.trigger( 'pagerInitialized', c ); c.$table.triggerHandler( 'pagerInitialized', c );
// filter widget not initialized; it will update the output display & fire off the pagerComplete event // filter widget not initialized; it will update the output display & fire off the pagerComplete event
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget( c.table, 'filter' ) ) ) { if ( !( c.widgetOptions.filter_initialized && ts.hasWidget( c.table, 'filter' ) ) ) {
// if ajax, then don't fire off pagerComplete // if ajax, then don't fire off pagerComplete
@ -504,7 +504,7 @@
.on( 'change' + namespace, function() { .on( 'change' + namespace, function() {
var v = $( this ).val(), var v = $( this ).val(),
pg = $( this ).hasClass( 'ts-startRow' ) ? Math.floor( v / p.size ) + 1 : v; pg = $( this ).hasClass( 'ts-startRow' ) ? Math.floor( v / p.size ) + 1 : v;
c.$table.trigger( 'pageSet' + namespace, [ pg ] ); c.$table.triggerHandler( 'pageSet' + namespace, [ pg ] );
}); });
} }
} }
@ -514,7 +514,7 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering pagerComplete' ); console.log( 'Pager: Triggering pagerComplete' );
} }
c.$table.trigger( 'pagerComplete', c ); c.$table.triggerHandler( 'pagerComplete', c );
// save pager info to storage // save pager info to storage
if ( wo.pager_savePages && ts.storage ) { if ( wo.pager_savePages && ts.storage ) {
ts.storage( table, wo.pager_storageKey, { ts.storage( table, wo.pager_storageKey, {
@ -811,7 +811,7 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering pagerChange' ); console.log( 'Pager: Triggering pagerChange' );
} }
$table.trigger( 'pagerChange', p ); $table.triggerHandler( 'pagerChange', p );
ts.applyWidget( table ); ts.applyWidget( table );
tsp.updatePageDisplay( c ); tsp.updatePageDisplay( c );
}, 0 ); }, 0 );
@ -928,7 +928,7 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering pagerChange' ); console.log( 'Pager: Triggering pagerChange' );
} }
c.$table.trigger( 'pagerChange', c ); c.$table.triggerHandler( 'pagerChange', c );
} }
if ( !wo.pager_removeRows ) { if ( !wo.pager_removeRows ) {
tsp.hideRows( c ); tsp.hideRows( c );
@ -961,7 +961,7 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering updateComplete' ); console.log( 'Pager: Triggering updateComplete' );
} }
c.$table.trigger( 'updateComplete', [ table, true ] ); c.$table.triggerHandler( 'updateComplete', [ table, true ] );
} }
}, },
@ -1077,13 +1077,13 @@
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering pageMoved' ); console.log( 'Pager: Triggering pageMoved' );
} }
c.$table.trigger( 'pageMoved', c ); c.$table.triggerHandler( 'pageMoved', c );
ts.applyWidget( table ); ts.applyWidget( table );
if ( !p.ajax && table.isUpdating ) { if ( !p.ajax && table.isUpdating ) {
if ( c.debug ) { if ( c.debug ) {
console.log( 'Pager: Triggering updateComplete' ); console.log( 'Pager: Triggering updateComplete' );
} }
c.$table.trigger( 'updateComplete', [ table, true ] ); c.$table.triggerHandler( 'updateComplete', [ table, true ] );
} }
} }
}, },

View File

@ -305,7 +305,7 @@
} }
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
// dynamically update sticky header widths // dynamically update sticky header widths
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
}, },
stopResize : function( c, wo ) { stopResize : function( c, wo ) {
@ -319,7 +319,7 @@
vars.mouseXPosition = 0; vars.mouseXPosition = 0;
vars.$target = vars.$next = null; vars.$target = vars.$next = null;
// will update stickyHeaders, just in case, see #912 // will update stickyHeaders, just in case, see #912
c.$table.trigger('stickyHeadersUpdate'); c.$table.triggerHandler('stickyHeadersUpdate');
} }
}; };
@ -381,7 +381,7 @@
} }
// reset stickyHeader widths // reset stickyHeader widths
c.$table.trigger( 'stickyHeadersUpdate' ); c.$table.triggerHandler( 'stickyHeadersUpdate' );
if ( ts.storage && !refreshing ) { if ( ts.storage && !refreshing ) {
ts.storage( this, ts.css.resizableStorage, {} ); ts.storage( this, ts.css.resizableStorage, {} );
} }

View File

@ -460,7 +460,7 @@
// update resizable widget handles // update resizable widget handles
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'resizableUpdate' ); c.$table.triggerHandler( 'resizableUpdate' );
}, 100 ); }, 100 );
}, },

View File

@ -27,7 +27,7 @@
c.$table.one( 'tablesorter-ready', function() { c.$table.one( 'tablesorter-ready', function() {
setTimeout(function(){ setTimeout(function(){
c.$table.one( 'filterEnd', function(){ c.$table.one( 'filterEnd', function(){
$(this).trigger( 'pageAndSize', [ page, size ] ); $(this).triggerHandler( 'pageAndSize', [ page, size ] );
}); });
$.tablesorter.setFilters( table, filter, true ); $.tablesorter.setFilters( table, filter, true );
}, 100 ); }, 100 );
@ -36,7 +36,7 @@
} }
if ( !filter ) { if ( !filter ) {
c.$table.one( 'tablesorter-ready', function() { c.$table.one( 'tablesorter-ready', function() {
c.$table.trigger( 'pageAndSize', [ page, size ] ); c.$table.triggerHandler( 'pageAndSize', [ page, size ] );
}); });
} }

View File

@ -109,7 +109,7 @@
$.tablesorter.processTbody(table, $tbody, false); // restore tbody $.tablesorter.processTbody(table, $tbody, false); // restore tbody
}); });
c.$table.trigger('staticRowsComplete', table); c.$table.triggerHandler('staticRowsComplete', table);
}, },
remove : function(table, c, wo){ remove : function(table, c, wo){

View File

@ -39,7 +39,7 @@
} }
} }
if ( headers.length && triggerEvent !== false ) { if ( headers.length && triggerEvent !== false ) {
c.$table.trigger( 'resize', [ headers ] ); c.$table.triggerHandler( 'resize', [ headers ] );
} }
wo.resize_flag = false; wo.resize_flag = false;
}; };
@ -266,7 +266,7 @@
} }
} }
$table.trigger('stickyHeadersInit'); $table.triggerHandler('stickyHeadersInit');
}, },
remove: function(table, c, wo) { remove: function(table, c, wo) {

View File

@ -148,10 +148,10 @@
view.hideTable(c, wo); view.hideTable(c, wo);
} }
$(c.$table).on('tablesorter-ready', function() { c.$table.on('tablesorter-ready', function() {
view.buildToolBar(c, wo); view.buildToolBar(c, wo);
view.buildView(c, wo); view.buildView(c, wo);
$(c.$table).trigger('viewComplete'); c.$table.triggerHandler('viewComplete');
}); });
}, },