Merge branch 'master' into gh-pages

This commit is contained in:
Rob Garrison 2016-11-26 19:40:26 -06:00
commit ee210cdba7
38 changed files with 764 additions and 353 deletions

View File

@ -102,6 +102,36 @@ If you would like to contribute, please...
View the [complete change log here](https://github.com/Mottie/tablesorter/wiki/Changes). View the [complete change log here](https://github.com/Mottie/tablesorter/wiki/Changes).
#### <a name="v2.28.0">Version 2.28.0</a> (11/27/2016)
* Core:
* Return value from `getColumnData` if not an object.
* Include extra headers when adding unsorted class. Fixes [issue #1306](https://github.com/Mottie/tablesorter/issues/1306).
* Add option validator. Fixes [issue #1319](https://github.com/Mottie/tablesorter/issues/1319).
* Maintain original settings on `resetToLoadState`.
* Docs:
* Add missing colon in CSS. Fixes [issue #1307](https://github.com/Mottie/tablesorter/issues/1307).
* Add notes on `sortList` overridding `sortForce` & `sortAppend`. See [issue #1286](https://github.com/Mottie/tablesorter/issues/1286).
* Update sortTbody widget demo showing new option.
* Add zebra widget to sort reset demo.
* Define a triggered "update". Fixes [issue #1317](https://github.com/Mottie/tablesorter/issues/1317).
* Clarify recalculation update method. Fixes [issue #1317](https://github.com/Mottie/tablesorter/issues/1317).
* Explain difference between `#` and `0` in the math mask. Fixes [issue #1320](https://github.com/Mottie/tablesorter/issues/1320).
* Add link to disable thead row example. Fixes [issue #1326](https://github.com/Mottie/tablesorter/issues/1326).
* Filter:
* Restore `filter_searchDelay` function. Fixes [issue #1299](https://github.com/Mottie/tablesorter/issues/1299).
* Grouping:
* Fix insertion of group header before child rows. See [pull #1301](https://github.com/Mottie/tablesorter/pull/1301); thanks [@babaevmm](https://github.com/babaevmm)! Also fixes [issue #1325](https://github.com/Mottie/tablesorter/issues/1325).
* Math:
* Fix prefix/suffix option names & processing. Fixes [issue #1305](https://github.com/Mottie/tablesorter/issues/1305).
* Remove `math_prefix` content prior to parsing cell values.
* Pager:
* Set `ariaDisabled` property to stop MS Edge crash. Fixes [issue #1303](https://github.com/Mottie/tablesorter/issues/1303).
* Restore settings on `resetToLoadState`. Fixes [issue #1311](https://github.com/Mottie/tablesorter/issues/1311).
* Tbodysort:
* Add `sortTbody_lockHead` option. See [pull #1312](https://github.com/Mottie/tablesorter/pull/1312); thanks [@ChrisM-Rogers](https://github.com/ChrisM-Rogers)!
* Add `sortTbody_lockHead` to default options.
#### <a name="v2.27.8">Version 2.27.8</a> (9/28/2016) #### <a name="v2.27.8">Version 2.27.8</a> (9/28/2016)
* Core: minor code cleanup. * Core: minor code cleanup.
@ -127,24 +157,3 @@ View the [complete change log here](https://github.com/Mottie/tablesorter/wiki/C
* RepeatHeaders: * RepeatHeaders:
* Repeat HTML content instead of only text. See [pull #1282](https://github.com/Mottie/tablesorter/pull/1282); thanks [@Milania1](https://github.com/Milania1)! * Repeat HTML content instead of only text. See [pull #1282](https://github.com/Mottie/tablesorter/pull/1282); thanks [@Milania1](https://github.com/Milania1)!
* Testing: update jQuery usage. * Testing: update jQuery usage.
#### <a name="v2.27.6">Version 2.27.6</a> (9/1/2016)
* Core: `textSorter` option now accepts class names. See [Stackoverflow](http://stackoverflow.com/q/39259954/145346).
* Docs:
* Update `emptyTo` demo. See [issue #1278](https://github.com/Mottie/tablesorter/issues/1278).
* Add `$.tablesorter.defaults` variable.
* Grouping: Add `"group-date-hour"` group type; added to demo.
* Mark:
* Apply marks after pager completes. See [issue #1243](https://github.com/Mottie/tablesorter/issues/1243).
* Add `mark_tsIgnore` option. See [issue #1243](https://github.com/Mottie/tablesorter/issues/1243).
* Parser: Header checkbox remains unchecked when table is hidden. Fixes [issue #1090](https://github.com/Mottie/tablesorter/issues/1090).
* Pager Custom Controls (beta)
* Prevent out-of-range page numbers. Fixes [issue #1276](https://github.com/Mottie/tablesorter/issues/1276).
* Allow settings `ends` and/or `aroundCurrent` to zero. See [issue #1276](https://github.com/Mottie/tablesorter/issues/1276).
* Spacer settings now include wrapper element (a `<span>` by default).
* Keyboard use changes.
* A pager element must now be focused before keyboard keys work.
* Keyboard keys now include left, right, up, down, pageUp, pageDown,
home, or end.
* `pageKeyStep` option added. Number of pages to skip with pageUp or pageDown.

View File

@ -1,6 +1,6 @@
/*! /*!
* tablesorter (FORK) pager plugin * tablesorter (FORK) pager plugin
* updated 9/23/2016 (v2.27.7) * updated 11/26/2016 (v2.28.0)
*/ */
/*jshint browser:true, jquery:true, unused:false */ /*jshint browser:true, jquery:true, unused:false */
;(function($) { ;(function($) {
@ -128,16 +128,25 @@
// hide arrows at extremes // hide arrows at extremes
pagerArrows = function( table, p, disable ) { pagerArrows = function( table, p, disable ) {
var a = 'addClass', var tmp,
r = 'removeClass', a = 'addClass',
d = p.cssDisabled, r = 'removeClass',
dis = !!disable, d = p.cssDisabled,
first = ( dis || p.page === 0 ), dis = !!disable,
tp = getTotalPages( table, p ), first = ( dis || p.page === 0 ),
last = ( dis || (p.page === tp - 1) || tp === 0 ); tp = getTotalPages( table, p ),
last = ( dis || (p.page === tp - 1) || tp === 0 );
if ( p.updateArrows ) { if ( p.updateArrows ) {
p.$container.find(p.cssFirst + ',' + p.cssPrev)[ first ? a : r ](d).attr('aria-disabled', first); tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev);
p.$container.find(p.cssNext + ',' + p.cssLast)[ last ? a : r ](d).attr('aria-disabled', last); tmp[ first ? a : r ](d); // toggle disabled class
tmp.each(function(){
this.ariaDisabled = first;
});
tmp = p.$container.find(p.cssNext + ',' + p.cssLast);
tmp[ last ? a : r ](d);
tmp.each(function(){
this.ariaDisabled = last;
});
} }
}, },
@ -689,9 +698,8 @@
.add( p.$container.find( '.ts-startRow, .ts-page' ) ); .add( p.$container.find( '.ts-startRow, .ts-page' ) );
len = $controls.length; len = $controls.length;
for ( index = 0; index < len; index++ ) { for ( index = 0; index < len; index++ ) {
$controls.eq( index ) $controls.eq( index ).addClass( p.cssDisabled )[0].disabled = true;
.attr( 'aria-disabled', 'true' ) $controls[ index ].ariaDisabled = true;
.addClass( p.cssDisabled )[0].disabled = true;
} }
}, },
@ -850,6 +858,12 @@
updatePageDisplay(table, p); updatePageDisplay(table, p);
}, },
resetState = function(table, p) {
var c = table.config;
c.pager = $.extend( true, {}, $.tablesorterPager.defaults, p.settings );
init(table, p.settings);
},
destroyPager = function(table, p) { destroyPager = function(table, p) {
var c = table.config, var c = table.config,
namespace = c.namespace + 'pager', namespace = c.namespace + 'pager',
@ -876,7 +890,9 @@
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page')) p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page'))
.removeClass(p.cssDisabled) .removeClass(p.cssDisabled)
.removeAttr('disabled') .removeAttr('disabled')
.attr('aria-disabled', 'false'); .each(function(){
this.ariaDisabled = false;
});
p.isDisabled = false; p.isDisabled = false;
p.page = $.data(table, 'pagerLastPage') || p.page || 0; p.page = $.data(table, 'pagerLastPage') || p.page || 0;
size = p.$size.find('option[selected]').val(); size = p.$size.find('option[selected]').val();
@ -904,6 +920,210 @@
console.log('Pager: Enabled'); console.log('Pager: Enabled');
} }
} }
},
init = function(table, settings) {
var t, ctrls, fxn, size,
c = table.config,
wo = c.widgetOptions,
p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ),
$t = c.$table,
namespace = c.namespace + 'pager',
// added in case the pager is reinitialized after being destroyed.
pager = p.$container = $(p.container).addClass('tablesorter-pager').show();
// save a copy of the original settings
p.settings = $.extend( true, {}, $.tablesorterPager.defaults, settings );
if (c.debug) {
console.log('Pager: Initializing');
}
p.oldAjaxSuccess = p.oldAjaxSuccess || p.ajaxObject.success;
c.appender = $this.appender;
p.initializing = true;
if (p.savePages && ts.storage) {
t = ts.storage(table, p.storageKey) || {}; // fixes #387
p.page = isNaN(t.page) ? p.page : t.page;
p.size = t.size === 'all' ? t.size : ( isNaN( t.size ) ? p.size : t.size ) || p.setSize || 10;
$.data(table, 'pagerLastSize', p.size);
pager.find(p.cssPageSize).val(p.size);
}
// skipped rows
p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
p.regexFiltered = new RegExp(wo.filter_filteredRow || 'filtered');
$t
// .unbind( namespace ) adding in jQuery 1.4.3 ( I think )
.unbind( pagerEvents.split(' ').join(namespace + ' ').replace(/\s+/g, ' ') )
.bind('filterInit filterStart '.split(' ').join(namespace + ' '), function(e, filters) {
p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
// don't change page if filters are the same (pager updating, etc)
if (e.type === 'filterStart' && p.pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
p.page = p.pageReset; // fixes #456 & #565
}
})
// update pager after filter widget completes
.bind('filterEnd sortEnd '.split(' ').join(namespace + ' '), function() {
p.currentFilters = c.$table.data('lastSearch');
if (p.initialized || p.initializing) {
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
// make sure we have a copy of all table rows once the cache has been built
updateCache(table);
}
updatePageDisplay(table, p, false);
moveToPage(table, p, false);
ts.applyWidget( table );
}
})
.bind('disablePager' + namespace, function(e){
e.stopPropagation();
showAllRows(table, p);
})
.bind('enablePager' + namespace, function(e){
e.stopPropagation();
enablePager(table, p, true);
})
.bind('destroyPager' + namespace, function(e){
e.stopPropagation();
destroyPager(table, p);
})
.bind('resetToLoadState' + namespace, function(e){
e.stopPropagation();
resetState(table, p);
})
.bind('updateComplete' + namespace, function(e, table, triggered){
e.stopPropagation();
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
// don't recalculate total rows/pages if using ajax
if ( !table || triggered || p.ajax ) { return; }
var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove);
p.totalRows = $rows.length - ( p.countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length );
p.totalPages = p.size === 'all' ? 1 : Math.ceil( p.totalRows / p.size );
if ($rows.length && c.rowsCopy && c.rowsCopy.length === 0) {
// make a copy of all table rows once the cache has been built
updateCache(table);
}
if ( p.page >= p.totalPages ) {
moveToLastPage(table, p);
}
hideRows(table, p);
changeHeight(table, p);
updatePageDisplay(table, p, true);
})
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size){
e.stopPropagation();
setPageSize(table, parsePageSize( p, size, 'get' ), p);
hideRows(table, p);
updatePageDisplay(table, p, false);
})
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num){
e.stopPropagation();
// force pager refresh
if (e.type === 'pagerUpdate') {
num = typeof num === 'undefined' ? p.page + 1 : num;
p.last.page = true;
}
p.page = (parseInt(num, 10) || 1) - 1;
moveToPage(table, p, true);
updatePageDisplay(table, p, false);
})
.bind('pageAndSize' + namespace, function(e, page, size){
e.stopPropagation();
p.page = (parseInt(page, 10) || 1) - 1;
setPageSize(table, parsePageSize( p, size, 'get' ), p);
moveToPage(table, p, true);
hideRows(table, p);
updatePageDisplay(table, p, false);
});
// clicked controls
ctrls = [ p.cssFirst, p.cssPrev, p.cssNext, p.cssLast ];
fxn = [ moveToFirstPage, moveToPrevPage, moveToNextPage, moveToLastPage ];
if (c.debug && !pager.length) {
console.warn('Pager: >> Container not found');
}
pager.find(ctrls.join(','))
.attr('tabindex', 0)
.unbind('click' + namespace)
.bind('click' + namespace, function(e){
e.stopPropagation();
var i, $t = $(this), l = ctrls.length;
if ( !$t.hasClass(p.cssDisabled) ) {
for (i = 0; i < l; i++) {
if ($t.is(ctrls[i])) {
fxn[i](table, p);
break;
}
}
}
});
// goto selector
p.$goto = pager.find(p.cssGoto);
if ( p.$goto.length ) {
p.$goto
.unbind('change' + namespace)
.bind('change' + namespace, function(){
p.page = $(this).val() - 1;
moveToPage(table, p, true);
updatePageDisplay(table, p, false);
});
} else if (c.debug) {
console.warn('Pager: >> Goto selector not found');
}
// page size selector
p.$size = pager.find(p.cssPageSize);
if ( p.$size.length ) {
// setting an option as selected appears to cause issues with initial page size
p.$size.find('option').removeAttr('selected');
p.$size.unbind('change' + namespace).bind('change' + namespace, function() {
if ( !$(this).hasClass(p.cssDisabled) ) {
var size = $(this).val();
p.$size.val( size ); // in case there are more than one pagers
setPageSize(table, size, p);
changeHeight(table, p);
}
return false;
});
} else if (c.debug) {
console.warn('Pager: >> Size selector not found');
}
// clear initialized flag
p.initialized = false;
// before initialization event
$t.triggerHandler('pagerBeforeInitialized', p);
enablePager(table, p, false);
if ( typeof p.ajaxUrl === 'string' ) {
// ajax pager; interact with database
p.ajax = true;
// When filtering with ajax, allow only custom filtering function, disable default
// filtering since it will be done server side.
c.widgetOptions.filter_serversideFiltering = true;
c.serverSideSorting = true;
moveToPage(table, p);
} else {
p.ajax = false;
// Regular pager; all rows stored in memory
ts.appendCache( c, true ); // true = don't apply widgets
hideRowsSetup(table, p);
}
// pager initialized
if (!p.ajax && !p.initialized) {
p.initializing = false;
p.initialized = true;
moveToPage(table, p);
if (c.debug) {
console.log('Pager: Triggering pagerInitialized');
}
c.$table.triggerHandler( 'pagerInitialized', p );
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
updatePageDisplay(table, p, false);
}
}
// make the hasWidget function think that the pager widget is being used
c.widgetInit.pager = true;
}; };
$this.appender = function(table, rows) { $this.appender = function(table, rows) {
@ -924,204 +1144,7 @@
return this.each(function() { return this.each(function() {
// check if tablesorter has initialized // check if tablesorter has initialized
if (!(this.config && this.hasInitialized)) { return; } if (!(this.config && this.hasInitialized)) { return; }
var t, ctrls, fxn, size, init(this, settings);
table = this,
c = table.config,
wo = c.widgetOptions,
p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ),
$t = c.$table,
namespace = c.namespace + 'pager',
// added in case the pager is reinitialized after being destroyed.
pager = p.$container = $(p.container).addClass('tablesorter-pager').show();
// save a copy of the original settings
p.settings = $.extend( true, {}, $.tablesorterPager.defaults, settings );
if (c.debug) {
console.log('Pager: Initializing');
}
p.oldAjaxSuccess = p.oldAjaxSuccess || p.ajaxObject.success;
c.appender = $this.appender;
p.initializing = true;
if (p.savePages && ts.storage) {
t = ts.storage(table, p.storageKey) || {}; // fixes #387
p.page = isNaN(t.page) ? p.page : t.page;
p.size = t.size === 'all' ? t.size : ( isNaN( t.size ) ? p.size : t.size ) || p.setSize || 10;
$.data(table, 'pagerLastSize', p.size);
pager.find(p.cssPageSize).val(p.size);
}
// skipped rows
p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
p.regexFiltered = new RegExp(wo.filter_filteredRow || 'filtered');
$t
// .unbind( namespace ) adding in jQuery 1.4.3 ( I think )
.unbind( pagerEvents.split(' ').join(namespace + ' ').replace(/\s+/g, ' ') )
.bind('filterInit filterStart '.split(' ').join(namespace + ' '), function(e, filters) {
p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
// don't change page if filters are the same (pager updating, etc)
if (e.type === 'filterStart' && p.pageReset !== false && (c.lastCombinedFilter || '') !== (p.currentFilters || []).join('')) {
p.page = p.pageReset; // fixes #456 & #565
}
})
// update pager after filter widget completes
.bind('filterEnd sortEnd '.split(' ').join(namespace + ' '), function() {
p.currentFilters = c.$table.data('lastSearch');
if (p.initialized || p.initializing) {
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
// make sure we have a copy of all table rows once the cache has been built
updateCache(table);
}
updatePageDisplay(table, p, false);
moveToPage(table, p, false);
ts.applyWidget( table );
}
})
.bind('disablePager' + namespace, function(e){
e.stopPropagation();
showAllRows(table, p);
})
.bind('enablePager' + namespace, function(e){
e.stopPropagation();
enablePager(table, p, true);
})
.bind('destroyPager' + namespace, function(e){
e.stopPropagation();
destroyPager(table, p);
})
.bind('updateComplete' + namespace, function(e, table, triggered){
e.stopPropagation();
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
// don't recalculate total rows/pages if using ajax
if ( !table || triggered || p.ajax ) { return; }
var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove);
p.totalRows = $rows.length - ( p.countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length );
p.totalPages = p.size === 'all' ? 1 : Math.ceil( p.totalRows / p.size );
if ($rows.length && c.rowsCopy && c.rowsCopy.length === 0) {
// make a copy of all table rows once the cache has been built
updateCache(table);
}
if ( p.page >= p.totalPages ) {
moveToLastPage(table, p);
}
hideRows(table, p);
changeHeight(table, p);
updatePageDisplay(table, p, true);
})
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size){
e.stopPropagation();
setPageSize(table, parsePageSize( p, size, 'get' ), p);
hideRows(table, p);
updatePageDisplay(table, p, false);
})
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num){
e.stopPropagation();
// force pager refresh
if (e.type === 'pagerUpdate') {
num = typeof num === 'undefined' ? p.page + 1 : num;
p.last.page = true;
}
p.page = (parseInt(num, 10) || 1) - 1;
moveToPage(table, p, true);
updatePageDisplay(table, p, false);
})
.bind('pageAndSize' + namespace, function(e, page, size){
e.stopPropagation();
p.page = (parseInt(page, 10) || 1) - 1;
setPageSize(table, parsePageSize( p, size, 'get' ), p);
moveToPage(table, p, true);
hideRows(table, p);
updatePageDisplay(table, p, false);
});
// clicked controls
ctrls = [ p.cssFirst, p.cssPrev, p.cssNext, p.cssLast ];
fxn = [ moveToFirstPage, moveToPrevPage, moveToNextPage, moveToLastPage ];
if (c.debug && !pager.length) {
console.warn('Pager: >> Container not found');
}
pager.find(ctrls.join(','))
.attr('tabindex', 0)
.unbind('click' + namespace)
.bind('click' + namespace, function(e){
e.stopPropagation();
var i, $t = $(this), l = ctrls.length;
if ( !$t.hasClass(p.cssDisabled) ) {
for (i = 0; i < l; i++) {
if ($t.is(ctrls[i])) {
fxn[i](table, p);
break;
}
}
}
});
// goto selector
p.$goto = pager.find(p.cssGoto);
if ( p.$goto.length ) {
p.$goto
.unbind('change' + namespace)
.bind('change' + namespace, function(){
p.page = $(this).val() - 1;
moveToPage(table, p, true);
updatePageDisplay(table, p, false);
});
} else if (c.debug) {
console.warn('Pager: >> Goto selector not found');
}
// page size selector
p.$size = pager.find(p.cssPageSize);
if ( p.$size.length ) {
// setting an option as selected appears to cause issues with initial page size
p.$size.find('option').removeAttr('selected');
p.$size.unbind('change' + namespace).bind('change' + namespace, function() {
if ( !$(this).hasClass(p.cssDisabled) ) {
var size = $(this).val();
p.$size.val( size ); // in case there are more than one pagers
setPageSize(table, size, p);
changeHeight(table, p);
}
return false;
});
} else if (c.debug) {
console.warn('Pager: >> Size selector not found');
}
// clear initialized flag
p.initialized = false;
// before initialization event
$t.triggerHandler('pagerBeforeInitialized', p);
enablePager(table, p, false);
if ( typeof p.ajaxUrl === 'string' ) {
// ajax pager; interact with database
p.ajax = true;
// When filtering with ajax, allow only custom filtering function, disable default
// filtering since it will be done server side.
c.widgetOptions.filter_serversideFiltering = true;
c.serverSideSorting = true;
moveToPage(table, p);
} else {
p.ajax = false;
// Regular pager; all rows stored in memory
ts.appendCache( c, true ); // true = don't apply widgets
hideRowsSetup(table, p);
}
// pager initialized
if (!p.ajax && !p.initialized) {
p.initializing = false;
p.initialized = true;
moveToPage(table, p);
if (c.debug) {
console.log('Pager: Triggering pagerInitialized');
}
c.$table.triggerHandler( 'pagerInitialized', p );
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
updatePageDisplay(table, p, false);
}
}
// make the hasWidget function think that the pager widget is being used
c.widgetInit.pager = true;
}); });
}; };

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 09-28-2016 (v2.27.8)*/ /*! tablesorter (FORK) - updated 11-26-2016 (v2.28.0)*/
/* 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) {
@ -10,7 +10,7 @@
} }
}(function(jQuery) { }(function(jQuery) {
/*! TableSorter (FORK) v2.27.8 *//* /*! TableSorter (FORK) v2.28.0 *//*
* Client-side table sorting with ease! * Client-side table sorting with ease!
* @requires jQuery v1.2.6+ * @requires jQuery v1.2.6+
* *
@ -34,7 +34,7 @@
'use strict'; 'use strict';
var ts = $.tablesorter = { var ts = $.tablesorter = {
version : '2.27.8', version : '2.28.0',
parsers : [], parsers : [],
widgets : [], widgets : [],
@ -128,7 +128,11 @@
headerList: [], headerList: [],
empties: {}, empties: {},
strings: {}, strings: {},
parsers: [] parsers: [],
// *** parser options for validator; values must be falsy!
globalize: 0,
imgAttr: 0
// removed: widgetZebra: { css: ['even', 'odd'] } // removed: widgetZebra: { css: ['even', 'odd'] }
@ -302,6 +306,7 @@
ts.setupParsers( c ); ts.setupParsers( c );
// start total row count at zero // start total row count at zero
c.totalRows = 0; c.totalRows = 0;
ts.validateOptions( c );
// build the cache for the tbody cells // build the cache for the tbody cells
// delayInit will delay building the cache until the user starts a sort // delayInit will delay building the cache until the user starts a sort
if ( !c.delayInit ) { ts.buildCache( c ); } if ( !c.delayInit ) { ts.buildCache( c ); }
@ -435,9 +440,11 @@
e.stopPropagation(); e.stopPropagation();
// remove all widgets // remove all widgets
ts.removeWidget( this, true, false ); ts.removeWidget( this, true, false );
var tmp = $.extend( true, {}, c.originalSettings );
// restore original settings; this clears out current settings, but does not clear // restore original settings; this clears out current settings, but does not clear
// values saved to storage. // values saved to storage.
c = $.extend( true, ts.defaults, c.originalSettings ); c = $.extend( true, ts.defaults, tmp );
c.originalSettings = tmp;
this.hasInitialized = false; this.hasInitialized = false;
// setup the entire table again // setup the entire table again
ts.setup( this, c ); ts.setup( this, c );
@ -1080,6 +1087,7 @@
.removeClass( css.join( ' ' ) ); .removeClass( css.join( ' ' ) );
// remove all header information // remove all header information
c.$headers c.$headers
.add( $( 'thead ' + c.namespace + '_extra_headers' ) )
.removeClass( css.join( ' ' ) ) .removeClass( css.join( ' ' ) )
.addClass( none ) .addClass( none )
.attr( 'aria-sort', 'none' ) .attr( 'aria-sort', 'none' )
@ -1922,6 +1930,8 @@
widget = ts.getWidgetById( c.widgets[ indx ] ); widget = ts.getWidgetById( c.widgets[ indx ] );
if ( widget && widget.options ) { if ( widget && widget.options ) {
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions ); c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
// add widgetOptions to defaults for option validator
$.extend( true, ts.defaults.widgetOptions, widget.options );
} }
} }
} }
@ -2294,7 +2304,9 @@
}, },
getColumnData : function( table, obj, indx, getCell, $headers ) { getColumnData : function( table, obj, indx, getCell, $headers ) {
if ( typeof obj === 'undefined' || obj === null ) { return; } if ( typeof obj !== 'object' || obj === null ) {
return obj;
}
table = $( table )[ 0 ]; table = $( table )[ 0 ];
var $header, key, var $header, key,
c = table.config, c = table.config,
@ -2405,6 +2417,34 @@
return str; return str;
}, },
validateOptions : function( c ) {
var setting, setting2, typ, timer,
// ignore options containing an array
ignore = 'sortForce sortList sortAppend widgets'.split( ' ' ),
orig = c.originalSettings;
if ( orig ) {
if ( c.debug ) {
timer = new Date();
}
for ( setting in orig ) {
typ = typeof ts.defaults[setting];
if ( typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '" option not recognized' );
} else if ( typ === 'object' ) {
for ( setting2 in orig[setting] ) {
typ = typeof ts.defaults[setting][setting2];
if ( $.inArray( setting, ignore ) < 0 && typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '.' + setting2 + '" option not recognized' );
}
}
}
}
if ( c.debug ) {
console.log( 'validate options time:' + ts.benchmark( timer ) );
}
}
},
// restore headers // restore headers
restoreHeaders : function( table ) { restoreHeaders : function( table ) {
var index, $cell, var index, $cell,
@ -2765,7 +2805,7 @@
})( jQuery ); })( jQuery );
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
/*global JSON:false */ /*global JSON:false */
;(function ($, window, document) { ;(function ($, window, document) {
'use strict'; 'use strict';
@ -2810,6 +2850,17 @@
url = options && options.url || url = options && options.url ||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') || $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname; wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
// update defaults for validator; these values must be falsy!
$.extend(true, ts.defaults, {
fixedUrl: '',
widgetOptions: {
storage_fixedUrl: '',
storage_group: '',
storage_page: '',
storage_tableId: '',
storage_useSessionStorage: ''
}
});
// https://gist.github.com/paulirish/5558557 // https://gist.github.com/paulirish/5558557
if (storageType in window) { if (storageType in window) {
try { try {
@ -3131,7 +3182,7 @@
})(jQuery); })(jQuery);
/*! Widget: filter - updated 9/23/2016 (v2.27.7) *//* /*! Widget: filter - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -3960,11 +4011,15 @@
// include change for select - fixes #473 // include change for select - fixes #473
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
wo.filter_liveSearch :
ts.getColumnData( table, wo.filter_liveSearch, column );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( table.config.widgetOptions.filter_initialized && if ( table.config.widgetOptions.filter_initialized &&
( event.which === tskeyCodes.enter || event.type === 'search' || ( event.which === tskeyCodes.enter || event.type === 'search' ||
( event.type === 'change' || event.type === 'input' ) && ( event.type === 'change' ||
( event.type === 'input' && liveSearch === true ) ) &&
this.value !== c.lastSearch[column] ) this.value !== c.lastSearch[column] )
) { ) {
event.preventDefault(); event.preventDefault();

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
} }
}(function(jQuery) { }(function(jQuery) {
/*! TableSorter (FORK) v2.27.8 *//* /*! TableSorter (FORK) v2.28.0 *//*
* Client-side table sorting with ease! * Client-side table sorting with ease!
* @requires jQuery v1.2.6+ * @requires jQuery v1.2.6+
* *
@ -32,7 +32,7 @@
'use strict'; 'use strict';
var ts = $.tablesorter = { var ts = $.tablesorter = {
version : '2.27.8', version : '2.28.0',
parsers : [], parsers : [],
widgets : [], widgets : [],
@ -126,7 +126,11 @@
headerList: [], headerList: [],
empties: {}, empties: {},
strings: {}, strings: {},
parsers: [] parsers: [],
// *** parser options for validator; values must be falsy!
globalize: 0,
imgAttr: 0
// removed: widgetZebra: { css: ['even', 'odd'] } // removed: widgetZebra: { css: ['even', 'odd'] }
@ -300,6 +304,7 @@
ts.setupParsers( c ); ts.setupParsers( c );
// start total row count at zero // start total row count at zero
c.totalRows = 0; c.totalRows = 0;
ts.validateOptions( c );
// build the cache for the tbody cells // build the cache for the tbody cells
// delayInit will delay building the cache until the user starts a sort // delayInit will delay building the cache until the user starts a sort
if ( !c.delayInit ) { ts.buildCache( c ); } if ( !c.delayInit ) { ts.buildCache( c ); }
@ -433,9 +438,11 @@
e.stopPropagation(); e.stopPropagation();
// remove all widgets // remove all widgets
ts.removeWidget( this, true, false ); ts.removeWidget( this, true, false );
var tmp = $.extend( true, {}, c.originalSettings );
// restore original settings; this clears out current settings, but does not clear // restore original settings; this clears out current settings, but does not clear
// values saved to storage. // values saved to storage.
c = $.extend( true, ts.defaults, c.originalSettings ); c = $.extend( true, ts.defaults, tmp );
c.originalSettings = tmp;
this.hasInitialized = false; this.hasInitialized = false;
// setup the entire table again // setup the entire table again
ts.setup( this, c ); ts.setup( this, c );
@ -1078,6 +1085,7 @@
.removeClass( css.join( ' ' ) ); .removeClass( css.join( ' ' ) );
// remove all header information // remove all header information
c.$headers c.$headers
.add( $( 'thead ' + c.namespace + '_extra_headers' ) )
.removeClass( css.join( ' ' ) ) .removeClass( css.join( ' ' ) )
.addClass( none ) .addClass( none )
.attr( 'aria-sort', 'none' ) .attr( 'aria-sort', 'none' )
@ -1920,6 +1928,8 @@
widget = ts.getWidgetById( c.widgets[ indx ] ); widget = ts.getWidgetById( c.widgets[ indx ] );
if ( widget && widget.options ) { if ( widget && widget.options ) {
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions ); c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
// add widgetOptions to defaults for option validator
$.extend( true, ts.defaults.widgetOptions, widget.options );
} }
} }
} }
@ -2292,7 +2302,9 @@
}, },
getColumnData : function( table, obj, indx, getCell, $headers ) { getColumnData : function( table, obj, indx, getCell, $headers ) {
if ( typeof obj === 'undefined' || obj === null ) { return; } if ( typeof obj !== 'object' || obj === null ) {
return obj;
}
table = $( table )[ 0 ]; table = $( table )[ 0 ];
var $header, key, var $header, key,
c = table.config, c = table.config,
@ -2403,6 +2415,34 @@
return str; return str;
}, },
validateOptions : function( c ) {
var setting, setting2, typ, timer,
// ignore options containing an array
ignore = 'sortForce sortList sortAppend widgets'.split( ' ' ),
orig = c.originalSettings;
if ( orig ) {
if ( c.debug ) {
timer = new Date();
}
for ( setting in orig ) {
typ = typeof ts.defaults[setting];
if ( typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '" option not recognized' );
} else if ( typ === 'object' ) {
for ( setting2 in orig[setting] ) {
typ = typeof ts.defaults[setting][setting2];
if ( $.inArray( setting, ignore ) < 0 && typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '.' + setting2 + '" option not recognized' );
}
}
}
}
if ( c.debug ) {
console.log( 'validate options time:' + ts.benchmark( timer ) );
}
}
},
// restore headers // restore headers
restoreHeaders : function( table ) { restoreHeaders : function( table ) {
var index, $cell, var index, $cell,

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 09-28-2016 (v2.27.8)*/ /*! tablesorter (FORK) - updated 11-26-2016 (v2.28.0)*/
/* 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) {
@ -10,7 +10,7 @@
} }
}(function(jQuery) { }(function(jQuery) {
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
/*global JSON:false */ /*global JSON:false */
;(function ($, window, document) { ;(function ($, window, document) {
'use strict'; 'use strict';
@ -55,6 +55,17 @@
url = options && options.url || url = options && options.url ||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') || $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname; wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
// update defaults for validator; these values must be falsy!
$.extend(true, ts.defaults, {
fixedUrl: '',
widgetOptions: {
storage_fixedUrl: '',
storage_group: '',
storage_page: '',
storage_tableId: '',
storage_useSessionStorage: ''
}
});
// https://gist.github.com/paulirish/5558557 // https://gist.github.com/paulirish/5558557
if (storageType in window) { if (storageType in window) {
try { try {
@ -376,7 +387,7 @@
})(jQuery); })(jQuery);
/*! Widget: filter - updated 9/23/2016 (v2.27.7) *//* /*! Widget: filter - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -1205,11 +1216,15 @@
// include change for select - fixes #473 // include change for select - fixes #473
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
wo.filter_liveSearch :
ts.getColumnData( table, wo.filter_liveSearch, column );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( table.config.widgetOptions.filter_initialized && if ( table.config.widgetOptions.filter_initialized &&
( event.which === tskeyCodes.enter || event.type === 'search' || ( event.which === tskeyCodes.enter || event.type === 'search' ||
( event.type === 'change' || event.type === 'input' ) && ( event.type === 'change' ||
( event.type === 'input' && liveSearch === true ) ) &&
this.value !== c.lastSearch[column] ) this.value !== c.lastSearch[column] )
) { ) {
event.preventDefault(); event.preventDefault();

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! Parser: two digit year - updated 11/22/2015 (v2.24.6) */ /*! Parser: two digit year - updated 11/26/2016 (v2.28.0) */
!function(a){"use strict";var b=50,c=a.tablesorter,d=(new Date).getFullYear();c.dates||(c.dates={}),c.dates.regxxxxyy=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,c.dates.regyyxxxx=/(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/,c.formatDate=function(a,c,e,f){if(a){var g,h,i=a.replace(/\s+/g," ").replace(/[-.,]/g,"/").replace(c,e),j=new Date(i);if(j instanceof Date&&isFinite(j)){for(g=j.getFullYear(),h=f&&f.config.dateRange||b;d-g>h;)g+=100;return j.setFullYear(g)}}return a},a.tablesorter.addParser({id:"ddmmyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$2/$1/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"mmddyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$1/$2/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"yymmdd",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regyyxxxx,"$2/$3/19$1",b)},type:"numeric"})}(jQuery); !function(a){"use strict";var b=50,c=a.tablesorter,d=(new Date).getFullYear();c.defaults.dataRange="",c.dates||(c.dates={}),c.dates.regxxxxyy=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,c.dates.regyyxxxx=/(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/,c.formatDate=function(a,c,e,f){if(a){var g,h,i=a.replace(/\s+/g," ").replace(/[-.,]/g,"/").replace(c,e),j=new Date(i);if(j instanceof Date&&isFinite(j)){for(g=j.getFullYear(),h=f&&f.config.dateRange||b;d-g>h;)g+=100;return j.setFullYear(g)}}return a},a.tablesorter.addParser({id:"ddmmyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$2/$1/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"mmddyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$1/$2/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"yymmdd",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regyyxxxx,"$2/$3/19$1",b)},type:"numeric"})}(jQuery);

View File

@ -1,2 +1,2 @@
/*! Parser: input & select - updated 9/1/2016 (v2.27.6) */ /*! Parser: input & select - updated 11/26/2016 (v2.28.0) */
!function(a){"use strict";var b=function(a,b,c){};a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,type:"numeric"}),a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d){var e=a(d),f=c.config.widgetOptions,g=f.group_checkbox?f.group_checkbox:["checked","unchecked"],h=e.find('input[type="checkbox"]'),i=h.length?h[0].checked:"";return h.length?g[i?0:1]:b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,type:"text"}),a(function(){if(a.fn.on){var c=function(a,b,c,d){a.toggleClass(b+"-"+c,d),(a[0].className||"").match(b+"-")?a.addClass(b):a.removeClass(b)},d=function(b,c){var d=window.navigator.userAgent,e=b.children("tbody").children(":visible"),f=e.length;b.children("thead").find('input[type="checkbox"]').each(function(){var b=a(this).closest("td, th").attr("data-column"),g=e.filter("."+c+"-"+b).length,h=g===f&&f>0;0===g||h?(this.checked=h,this.indeterminate=!1):(this.checked=!(d.indexOf("Trident/")>-1||d.indexOf("Edge/")>-1),this.indeterminate=!0)})};a("table").on("tablesorter-initialized updateComplete",function(){this.tablesorterBusy=!1;var e=".parser-forms";a(this).children("tbody").off(e).on("mouseleave"+e,function(b){"TBODY"===b.target.nodeName&&a(":focus").blur()}).on("focus"+e,"select, input:not([type=checkbox]), textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+e,"input:not([type=checkbox]), textarea",function(){this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(e+" "),"select, input, textarea",function(e){if(27===e.which&&("INPUT"!==this.nodeName||"checkbox"!==this.type))return void(this.value=a(this).data("ts-original-value"));if("change"===e.type||"keyup"===e.type&&13===e.which&&("INPUT"===e.target.nodeName||"TEXTAREA"===e.target.nodeName&&e.altKey)){var f,g,h=a(e.target),i="checkbox"===e.target.type,j=h.closest("td"),k=j.closest("table"),l=j[0].cellIndex,m=k[0].config||!1,n=k.length&&k[0].tablesorterBusy,o=m&&m.$headerIndexed&&m.$headerIndexed[l]||[],p=i?e.target.checked:h.val();if(a.isEmptyObject(m)||n!==!1)return;if(i&&(g=m.checkboxClass||"checked",c(j.closest("tr"),g,l,p),d(k,g)),o.length&&(o.hasClass("parser-false")||o.hasClass("sorter-false")&&o.hasClass("filter-false"))||"change"===e.type&&m.table.isUpdating)return;(m&&p!==h.data("ts-original-value")||i)&&(h.data("ts-original-value",p),k[0].tablesorterBusy=!0,a.tablesorter.updateCell(m,j,f,function(){b(e,k,h),k[0].tablesorterBusy=!1}))}}),a(this).children("thead").find('input[type="checkbox"]')&&a(this).off(e).on("tablesorter-ready"+e,function(){var b,c=a(this),e=c.length&&c[0].config;a.isEmptyObject(e)||(this.tablesorterBusy=!0,b=e&&e.checkboxClass||"checked",d(c,b),this.tablesorterBusy=!1)}).children("thead").off(e).on("click"+e+" change"+e,'input[type="checkbox"]',function(e){var f,g,h,i,j,k,l=a(this),m=l.closest("table"),n=m.length&&m[0].config,o=this.checked;return!(!m.length||!n||m[0].tablesorterBusy)&&(h=parseInt(l.closest("td, th").attr("data-column"),10),j="checkbox"===n.parsers[h].id,g=m.length&&n.checkboxVisible,m[0].tablesorterBusy=!0,i=m.children("tbody").children("tr"+("undefined"==typeof g||g===!0?":visible":"")).children(":nth-child("+(h+1)+")").find('input[type="checkbox"]').prop("checked",o),k=n.checkboxClass||"checked",i.each(function(){c(a(this).closest("tr"),k,h,o)}),d(m,k),j?a.tablesorter.update(n,f,function(){b(e,m,i),m[0].tablesorterBusy=!1}):(b(e,m,i),m[0].tablesorterBusy=!1),!0)})})}})}(jQuery); !function(a){"use strict";var b=function(a,b,c){};a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,type:"numeric"}),a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d){var e=a(d),f=c.config.widgetOptions,g=f.group_checkbox?f.group_checkbox:["checked","unchecked"],h=e.find('input[type="checkbox"]'),i=h.length?h[0].checked:"";return h.length?g[i?0:1]:b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,type:"text"}),ts.defaults.checkboxClass="",ts.defaults.checkboxVisible="",a(function(){if(a.fn.on){var c=function(a,b,c,d){a.toggleClass(b+"-"+c,d),(a[0].className||"").match(b+"-")?a.addClass(b):a.removeClass(b)},d=function(b,c){var d=window.navigator.userAgent,e=b.children("tbody").children(":visible"),f=e.length;b.children("thead").find('input[type="checkbox"]').each(function(){var b=a(this).closest("td, th").attr("data-column"),g=e.filter("."+c+"-"+b).length,h=g===f&&f>0;0===g||h?(this.checked=h,this.indeterminate=!1):(this.checked=!(d.indexOf("Trident/")>-1||d.indexOf("Edge/")>-1),this.indeterminate=!0)})};a("table").on("tablesorter-initialized updateComplete",function(){this.tablesorterBusy=!1;var e=".parser-forms";a(this).children("tbody").off(e).on("mouseleave"+e,function(b){"TBODY"===b.target.nodeName&&a(":focus").blur()}).on("focus"+e,"select, input:not([type=checkbox]), textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+e,"input:not([type=checkbox]), textarea",function(){this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(e+" "),"select, input, textarea",function(e){if(27===e.which&&("INPUT"!==this.nodeName||"checkbox"!==this.type))return void(this.value=a(this).data("ts-original-value"));if("change"===e.type||"keyup"===e.type&&13===e.which&&("INPUT"===e.target.nodeName||"TEXTAREA"===e.target.nodeName&&e.altKey)){var f,g,h=a(e.target),i="checkbox"===e.target.type,j=h.closest("td"),k=j.closest("table"),l=j[0].cellIndex,m=k[0].config||!1,n=k.length&&k[0].tablesorterBusy,o=m&&m.$headerIndexed&&m.$headerIndexed[l]||[],p=i?e.target.checked:h.val();if(a.isEmptyObject(m)||n!==!1)return;if(i&&(g=m.checkboxClass||"checked",c(j.closest("tr"),g,l,p),d(k,g)),o.length&&(o.hasClass("parser-false")||o.hasClass("sorter-false")&&o.hasClass("filter-false"))||"change"===e.type&&m.table.isUpdating)return;(m&&p!==h.data("ts-original-value")||i)&&(h.data("ts-original-value",p),k[0].tablesorterBusy=!0,a.tablesorter.updateCell(m,j,f,function(){b(e,k,h),k[0].tablesorterBusy=!1}))}}),a(this).children("thead").find('input[type="checkbox"]')&&a(this).off(e).on("tablesorter-ready"+e,function(){var b,c=a(this),e=c.length&&c[0].config;a.isEmptyObject(e)||(this.tablesorterBusy=!0,b=e&&e.checkboxClass||"checked",d(c,b),this.tablesorterBusy=!1)}).children("thead").off(e).on("click"+e+" change"+e,'input[type="checkbox"]',function(e){var f,g,h,i,j,k,l=a(this),m=l.closest("table"),n=m.length&&m[0].config,o=this.checked;return!(!m.length||!n||m[0].tablesorterBusy)&&(h=parseInt(l.closest("td, th").attr("data-column"),10),j="checkbox"===n.parsers[h].id,g=m.length&&n.checkboxVisible,m[0].tablesorterBusy=!0,i=m.children("tbody").children("tr"+("undefined"==typeof g||g===!0?":visible":"")).children(":nth-child("+(h+1)+")").find('input[type="checkbox"]').prop("checked",o),k=n.checkboxClass||"checked",i.each(function(){c(a(this).closest("tr"),k,h,o)}),d(m,k),j?a.tablesorter.update(n,f,function(){b(e,m,i),m[0].tablesorterBusy=!1}):(b(e,m,i),m[0].tablesorterBusy=!1),!0)})})}})}(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

View File

@ -1,5 +1,6 @@
/*! tablesorter tbody sorting widget (BETA) - 11/22/2015 (v2.24.6) /*! tablesorter tbody sorting widget (BETA) - 11/26/2016 (v2.28.0)
* Requires tablesorter v2.22.2+ and jQuery 1.4+ * Requires tablesorter v2.22.2+ and jQuery 1.4+
* by Rob Garrison * by Rob Garrison
* Contributors: Chris Rogers
*/ */
!function(a){"use strict";var b=a.tablesorter;b.sortTbodies={init:function(c,d){var e,f,g,h,i,j=c.namespace+"sortTbody",k=c.$table.children("tbody"),l=k.length;for(d.sortTbody_original_serverSideSorting=c.serverSideSorting,d.sortTbody_original_cssInfoBlock=c.cssInfoBlock,c.cssInfoBlock=d.sortTbody_noSort,b.sortTbodies.setTbodies(c,d),e=0;e<l;e++)k.eq(e).attr("data-ts-original-order",e);for(c.$table.unbind("sortBegin updateComplete ".split(" ").join(j+" ")).bind("sortBegin"+j,function(){b.sortTbodies.sorter(c)}).bind("updateComplete"+j,function(){b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)}),(a.isEmptyObject(c.parsers)||c.$tbodies.length!==k.length)&&(b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)),i=k.children("tr"),l=i.length,e=0;e<c.columns;e++){if(h=0,"numeric"===c.parsers[e].type)for(f=0;f<l;f++)g=b.getParsedText(c,i.eq(f).children()[e],e),h=Math.max(Math.abs(g)||0,h);c.$headerIndexed[e].attr("data-ts-col-max-value",h)}},setTbodies:function(a,b){a.$tbodies=a.$table.children("tbody").not("."+b.sortTbody_noSort)},sorter:function(c){var d=c.$table,e=c.widgetOptions;if(e.sortTbody_busy!==!0){e.sortTbody_busy=!0;var f=d.children("tbody").not("."+e.sortTbody_noSort),g=e.sortTbody_primaryRow||"tr:eq(0)",h=c.sortList||[],i=h.length;i&&(c.serverSideSorting=!e.sortTbody_sortRows,f.sort(function(d,e){var f,j,k,l,m,n,o,p,q,r,s,t,u=c.table,v=c.parsers,w=c.textSorter||"",x=a(d),y=a(e),z=x.find(g).children("td, th"),A=y.find(g).children("td, th");for(f=0;f<i;f++){if(o=h[f][0],p=h[f][1],k=0===p,j=b.getElementText(c,z.eq(o),o),q=v[o].format(j,u,z[o],o),j=b.getElementText(c,A.eq(o),o),r=v[o].format(j,u,A[o],o),c.sortStable&&q===r&&1===i)return x.attr("data-ts-original-order")-y.attr("data-ts-original-order");if(l=/n/i.test(v&&v[o]?v[o].type||"":""),l&&c.strings[o]?(m=c.$headerIndexed[o].attr("data-ts-col-max-value")||1.79e308,l="boolean"==typeof b.string[c.strings[o]]?(k?1:-1)*(b.string[c.strings[o]]?-1:1):c.strings[o]?b.string[c.strings[o]]||0:0,n=c.numberSorter?c.numberSorter(q,r,k,m,u):b["sortNumeric"+(k?"Asc":"Desc")](q,r,l,m,o,c)):(s=k?q:r,t=k?r:q,n="function"==typeof w?w(s,t,k,o,u):"object"==typeof w&&w.hasOwnProperty(o)?w[o](s,t,k,o,u):b["sortNatural"+(k?"Asc":"Desc")](q,r,o,c)),n)return n}return x.attr("data-ts-original-order")-y.attr("data-ts-original-order")}),b.sortTbodies.restoreTbodies(c,e,f),e.sortTbody_busy=!1)}},restoreTbodies:function(a,b,c){var d,e,f,g,h,i,j,k=a.$table,l=!0,m=0;if(k.hide(),c.appendTo(k),e=k.children("tbody"),g=e.length,d=e.filter("."+b.sortTbody_noSort).appendTo(k),h=d.length)for(;l&&m<h;){for(l=!1,i=0;i<h;i++)j=parseInt(d.eq(i).attr("data-ts-original-order"),10),j=j>=g?g:j<0?0:j,j!==d.eq(i).index()&&(l=!0,f=d.eq(i).detach(),j>=g?f.appendTo(k):0===j?f.prependTo(k):f.insertBefore(k.children("tbody:eq("+j+")")));m++}k.show()}},b.addWidget({id:"sortTbody",priority:40,options:{sortTbody_primaryRow:null,sortTbody_sortRows:!1,sortTbody_noSort:"tablesorter-no-sort-tbody"},init:function(a,c,d,e){b.sortTbodies.init(d,e)},remove:function(a,b,c,d){b.$table.unbind("sortBegin updateComplete ".split(" ").join(b.namespace+"sortTbody ")),b.serverSideSorting=c.sortTbody_original_serverSideSorting,b.cssInfoBlock=c.sortTbody_original_cssInfoBlock}})}(jQuery); !function(a){"use strict";var b=a.tablesorter;b.sortTbodies={init:function(c,d){var e,f,g,h,i,j=c.namespace+"sortTbody",k=c.$table.children("tbody"),l=k.length;for(d.sortTbody_original_serverSideSorting=c.serverSideSorting,d.sortTbody_original_cssInfoBlock=c.cssInfoBlock,c.cssInfoBlock=d.sortTbody_noSort,b.sortTbodies.setTbodies(c,d),e=0;e<l;e++)k.eq(e).attr("data-ts-original-order",e);for(c.$table.unbind("sortBegin updateComplete ".split(" ").join(j+" ")).bind("sortBegin"+j,function(){b.sortTbodies.sorter(c)}).bind("updateComplete"+j,function(){b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)}).bind("sortEnd",function(){var b=d.sortTbody_primaryRow;d.sortTbody_lockHead&&b&&c.$table.find(b).each(function(){a(this).parents("tbody").prepend(this)})}),(a.isEmptyObject(c.parsers)||c.$tbodies.length!==k.length)&&(b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)),i=k.children("tr"),l=i.length,e=0;e<c.columns;e++){if(h=0,"numeric"===c.parsers[e].type)for(f=0;f<l;f++)g=b.getParsedText(c,i.eq(f).children()[e],e),h=Math.max(Math.abs(g)||0,h);c.$headerIndexed[e].attr("data-ts-col-max-value",h)}},setTbodies:function(a,b){a.$tbodies=a.$table.children("tbody").not("."+b.sortTbody_noSort)},sorter:function(c){var d=c.$table,e=c.widgetOptions;if(e.sortTbody_busy!==!0){e.sortTbody_busy=!0;var f=d.children("tbody").not("."+e.sortTbody_noSort),g=e.sortTbody_primaryRow||"tr:eq(0)",h=c.sortList||[],i=h.length;i&&(c.serverSideSorting=!e.sortTbody_sortRows,f.sort(function(d,e){var f,j,k,l,m,n,o,p,q,r,s,t,u=c.table,v=c.parsers,w=c.textSorter||"",x=a(d),y=a(e),z=x.find(g).children("td, th"),A=y.find(g).children("td, th");for(f=0;f<i;f++){if(o=h[f][0],p=h[f][1],k=0===p,j=b.getElementText(c,z.eq(o),o),q=v[o].format(j,u,z[o],o),j=b.getElementText(c,A.eq(o),o),r=v[o].format(j,u,A[o],o),c.sortStable&&q===r&&1===i)return x.attr("data-ts-original-order")-y.attr("data-ts-original-order");if(l=/n/i.test(v&&v[o]?v[o].type||"":""),l&&c.strings[o]?(m=c.$headerIndexed[o].attr("data-ts-col-max-value")||1.79e308,l="boolean"==typeof b.string[c.strings[o]]?(k?1:-1)*(b.string[c.strings[o]]?-1:1):c.strings[o]?b.string[c.strings[o]]||0:0,n=c.numberSorter?c.numberSorter(q,r,k,m,u):b["sortNumeric"+(k?"Asc":"Desc")](q,r,l,m,o,c)):(s=k?q:r,t=k?r:q,n="function"==typeof w?w(s,t,k,o,u):"object"==typeof w&&w.hasOwnProperty(o)?w[o](s,t,k,o,u):b["sortNatural"+(k?"Asc":"Desc")](q,r,o,c)),n)return n}return x.attr("data-ts-original-order")-y.attr("data-ts-original-order")}),b.sortTbodies.restoreTbodies(c,e,f),e.sortTbody_busy=!1)}},restoreTbodies:function(a,b,c){var d,e,f,g,h,i,j,k=a.$table,l=!0,m=0;if(k.hide(),c.appendTo(k),e=k.children("tbody"),g=e.length,d=e.filter("."+b.sortTbody_noSort).appendTo(k),h=d.length)for(;l&&m<h;){for(l=!1,i=0;i<h;i++)j=parseInt(d.eq(i).attr("data-ts-original-order"),10),j=j>=g?g:j<0?0:j,j!==d.eq(i).index()&&(l=!0,f=d.eq(i).detach(),j>=g?f.appendTo(k):0===j?f.prependTo(k):f.insertBefore(k.children("tbody:eq("+j+")")));m++}k.show()}},b.addWidget({id:"sortTbody",priority:40,options:{sortTbody_lockHead:!1,sortTbody_primaryRow:null,sortTbody_sortRows:!1,sortTbody_noSort:"tablesorter-no-sort-tbody"},init:function(a,c,d,e){b.sortTbodies.init(d,e)},remove:function(a,b,c,d){b.$table.unbind("sortBegin updateComplete ".split(" ").join(b.namespace+"sortTbody ")),b.serverSideSorting=c.sortTbody_original_serverSideSorting,b.cssInfoBlock=c.sortTbody_original_cssInfoBlock}})}(jQuery);

View File

@ -1,2 +1,2 @@
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
!function(a,b,c){"use strict";var d=a.tablesorter||{};d.storage=function(d,e,f,g){d=a(d)[0];var h,i,j,k=!1,l={},m=d.config,n=m&&m.widgetOptions,o=g&&g.useSessionStorage||n&&n.storage_useSessionStorage?"sessionStorage":"localStorage",p=a(d),q=g&&g.id||p.attr(g&&g.group||n&&n.storage_group||"data-table-group")||n&&n.storage_tableId||d.id||a(".tablesorter").index(p),r=g&&g.url||p.attr(g&&g.page||n&&n.storage_page||"data-table-page")||n&&n.storage_fixedUrl||m&&m.fixedUrl||b.location.pathname;if(o in b)try{b[o].setItem("_tmptest","temp"),k=!0,b[o].removeItem("_tmptest")}catch(a){m&&m.debug&&console.warn(o+" is not supported in this browser")}return a.parseJSON&&(k?l=a.parseJSON(b[o][e]||"null")||{}:(i=c.cookie.split(/[;\s|=]/),h=a.inArray(e,i)+1,l=0!==h?a.parseJSON(i[h]||"null")||{}:{})),"undefined"!=typeof f&&b.JSON&&JSON.hasOwnProperty("stringify")?(l[r]||(l[r]={}),l[r][q]=f,k?b[o][e]=JSON.stringify(l):(j=new Date,j.setTime(j.getTime()+31536e6),c.cookie=e+"="+JSON.stringify(l).replace(/\"/g,'"')+"; expires="+j.toGMTString()+"; path=/"),void 0):l&&l[r]?l[r][q]:""}}(jQuery,window,document); !function(a,b,c){"use strict";var d=a.tablesorter||{};d.storage=function(e,f,g,h){e=a(e)[0];var i,j,k,l=!1,m={},n=e.config,o=n&&n.widgetOptions,p=h&&h.useSessionStorage||o&&o.storage_useSessionStorage?"sessionStorage":"localStorage",q=a(e),r=h&&h.id||q.attr(h&&h.group||o&&o.storage_group||"data-table-group")||o&&o.storage_tableId||e.id||a(".tablesorter").index(q),s=h&&h.url||q.attr(h&&h.page||o&&o.storage_page||"data-table-page")||o&&o.storage_fixedUrl||n&&n.fixedUrl||b.location.pathname;if(a.extend(!0,d.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_tableId:"",storage_useSessionStorage:""}}),p in b)try{b[p].setItem("_tmptest","temp"),l=!0,b[p].removeItem("_tmptest")}catch(a){n&&n.debug&&console.warn(p+" is not supported in this browser")}return a.parseJSON&&(l?m=a.parseJSON(b[p][f]||"null")||{}:(j=c.cookie.split(/[;\s|=]/),i=a.inArray(f,j)+1,m=0!==i?a.parseJSON(j[i]||"null")||{}:{})),"undefined"!=typeof g&&b.JSON&&JSON.hasOwnProperty("stringify")?(m[s]||(m[s]={}),m[s][r]=g,l?b[p][f]=JSON.stringify(m):(k=new Date,k.setTime(k.getTime()+31536e6),c.cookie=f+"="+JSON.stringify(m).replace(/\"/g,'"')+"; expires="+k.toGMTString()+"; path=/"),void 0):m&&m[s]?m[s][r]:""}}(jQuery,window,document);

View File

@ -21,7 +21,8 @@
// call the tablesorter plugin // call the tablesorter plugin
$("table").tablesorter({ $("table").tablesorter({
theme : 'blue', theme : 'blue',
sortList: [ [0,0],[1,0],[2,0] ] sortList: [ [0,0],[1,0],[2,0] ],
widgets: ['zebra']
}); });
$('button').click(function(){ $('button').click(function(){

View File

@ -710,7 +710,7 @@ $.tablesorter.columnSelector.refreshColumns( config, optionName, optionState );<
&lt;table class=&quot;tablesorter custom-popup&quot;&gt; &lt;table class=&quot;tablesorter custom-popup&quot;&gt;
&lt;thead&gt; &lt;thead&gt;
&lt;tr&gt; &lt;tr class="tablesorter-ignoreRow"&gt; &lt;!-- Ignore all cell content; disable sorting & form interaction --&gt;
&lt;th data-priority=&quot;critical&quot;&gt;Name&lt;/th&gt; &lt;th data-priority=&quot;critical&quot;&gt;Name&lt;/th&gt;
&lt;!-- Remove column from selection popup by including --&gt; &lt;!-- Remove column from selection popup by including --&gt;
&lt;!-- data-priority=&quot;Anything other than 1-6&quot; OR data-column-selector=&quot;disable&quot; OR class=&quot;columnSelector-disable&quot; --&gt; &lt;!-- data-priority=&quot;Anything other than 1-6&quot; OR data-column-selector=&quot;disable&quot; OR class=&quot;columnSelector-disable&quot; --&gt;

View File

@ -196,6 +196,13 @@
<h3><a href="#">Notes</a></h3> <h3><a href="#">Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.28.0</span>
<ul>
<li>Fix documentation and processing of <code>math_prefix</code> and <code>math_suffix</code> options. See <a href="https://github.com/Mottie/tablesorter/issues/1305">issue #1305</a>.</li>
<li>Remove <code>math_prefix</code> content prior to parsing table cell values.</li>
<li>Added "Methods" section & more mask examples.</li>
</ul>
</li>
<li>In <span class="version">v2.27.0</span> <li>In <span class="version">v2.27.0</span>
<ul> <ul>
<li>Added check for <code>data-math-target</code> attribute which allows you to target an element inside the table cell. See the <a href="#attribute_settings">Attribute Settings</a> &gt; <strong>Targeting cell content</strong> section below.</li> <li>Added check for <code>data-math-target</code> attribute which allows you to target an element inside the table cell. See the <a href="#attribute_settings">Attribute Settings</a> &gt; <strong>Targeting cell content</strong> section below.</li>
@ -217,19 +224,19 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>In <span class="version">v2.24.6</span>, added <code>math_rowFilter</code> option.</li>
<li>In <span class="version">v2.24.0</span>
<ul>
<li>Added "below" type of data-gathering (see <a href="#attribute_settings">Attribute Settings</a> below for more info). See <a href="https://github.com/Mottie/tablesorter/pull/1027">pull #873</a>; thanks to <a href="https://github.com/LvLynx">LvLynx</a>!.</li>
<li>Added <code>math_none</code> option which allows customizing the text added to a cell when there are no matching math elements (.</li>
</ul>
</li>
</ul> </ul>
<div class="accordion start-closed"> <div class="accordion start-closed">
<h3 id="old-notes"><a href="#">Older Notes</a></h3> <h3 id="old-notes"><a href="#">Older Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.24.6</span>, added <code>math_rowFilter</code> option.</li>
<li>In <span class="version">v2.24.0</span>
<ul>
<li>Added "below" type of data-gathering (see <a href="#attribute_settings">Attribute Settings</a> below for more info). See <a href="https://github.com/Mottie/tablesorter/pull/1027">pull #873</a>; thanks to <a href="https://github.com/LvLynx">LvLynx</a>!.</li>
<li>Added <code>math_none</code> option which allows customizing the text added to a cell when there are no matching math elements (.</li>
</ul>
</li>
<li>In <span class="version updated">v2.22.0</span>, <li>In <span class="version updated">v2.22.0</span>,
<ul> <ul>
<li>Fixed an issue with a sum column encountering a cell without a defined "data-math" attribute returning an empty string instead of zero. See <a href="https://github.com/Mottie/tablesorter/issues/873">issue #873</a>.</li> <li>Fixed an issue with a sum column encountering a cell without a defined "data-math" attribute returning an empty string instead of zero. See <a href="https://github.com/Mottie/tablesorter/issues/873">issue #873</a>.</li>
@ -249,6 +256,7 @@
<li>Added "Mask Examples" section with examples, and how to use the <code>$.tablesorter.formatMask</code> function.</li> <li>Added "Mask Examples" section with examples, and how to use the <code>$.tablesorter.formatMask</code> function.</li>
</ul> </ul>
</li> </li>
<li>Added math widget in v2.16.0-beta</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -306,7 +314,7 @@
<p>By default, recalculations are performed after:</p> <p>By default, recalculations are performed after:</p>
<ul> <ul>
<li>Tablesorter initialization.</li> <li>Tablesorter initialization.</li>
<li>After any triggered "update" which may change a cell value.</li> <li>After any call to a tablesorter method which updates the internal cache (e.g. "update", "updateCell", etc). The math widget listens for the <a href="index.html#updatecomplete">updateComplete</a> event, which occurs after the internal cache has completed updating, before recalculating values.</li>
<li>After a "filterReset".</li> <li>After a "filterReset".</li>
<li>And after a "filterEnd" event, <em>or</em> a "pagerComplete" event (if the pager is being used), but not both!</li> <li>And after a "filterEnd" event, <em>or</em> a "pagerComplete" event (if the pager is being used), but not both!</li>
</ul> </ul>
@ -352,7 +360,7 @@ math_complete : function($cell, wo, result, value, arry) {
<td> <td>
Set this option with an output formatting mask to use <span class="xsmall results">&dagger;</span> Set this option with an output formatting mask to use <span class="xsmall results">&dagger;</span>
<div class="collapsible"> <div class="collapsible">
<p>As of <span class="version">v2.16.2</span>, you can set a mask for each math cell by adding a <code>data-math-mask</code> data-attribute (the <code>math</code> part of the data-attribute is obtained from the <code>math_data</code> setting).</p> <p>As of <span class="version">v2.16.2</span>, you can set a mask for each math cell by adding a <code>data-math-mask</code> data-attribute (the <code>math</code> part of the data-attribute is named from the <code>math_data</code> setting).</p>
<pre class="prettyprint lang-html">&lt;th data-math=&quot;all-sum&quot; data-math-mask=&quot;##0.00&quot;&gt;all-sum&lt;/th&gt;</pre> <pre class="prettyprint lang-html">&lt;th data-math=&quot;all-sum&quot; data-math-mask=&quot;##0.00&quot;&gt;all-sum&lt;/th&gt;</pre>
<hr> <hr>
<h3>Javascript-number-formatter details</h3> <h3>Javascript-number-formatter details</h3>
@ -380,11 +388,12 @@ math_complete : function($cell, wo, result, value, arry) {
</ul> </ul>
<h3>Note</h3> <h3>Note</h3>
<ul> <ul>
<li>The difference between using <code>#</code> and <code>0</code> in the mask, is that when a value of zero is passed to the function, the <code>#</code> mask will return an empty string whereas the <code>0</code> mask will return a zero.</li>
<li>When there's only one symbol is supplied, system will always treat the single symbol as Decimal. For instance, <code>$.tablesorter.formatMask( '#,###', 1234567.890)</code> will output <code>1234567,890</code>.</li> <li>When there's only one symbol is supplied, system will always treat the single symbol as Decimal. For instance, <code>$.tablesorter.formatMask( '#,###', 1234567.890)</code> will output <code>1234567,890</code>.</li>
<li>To force a single symbol as Separator, add a trailing dot to the end like this: <code>$.tablesorter.formatMask( '#,###.', 1234567.890)</code> which will then output <code>1,234,567</code>.</li> <li>To force a single symbol as Separator, add a trailing dot to the end like this: <code>$.tablesorter.formatMask( '#,###.', 1234567.890)</code> which will then output <code>1,234,567</code>.</li>
<li><a href="http://www.integraxor.com/developer/codes/js-formatter/format-sample.htm">Original plugin demo</a></li> <li><a href="http://www.integraxor.com/developer/codes/js-formatter/format-sample.htm">Original plugin demo</a></li>
</ul> </ul>
<span class="remark">&dagger;</span> The number formatter code was copied from <a href="https://code.google.com/p/javascript-number-formatter/">javascript-number-formatter</a> (<a href="http://opensource.org/licenses/mit-license.php">MIT</a>) - now forked on <a href="https://github.com/Mottie/javascript-number-formatter">GitHub</a>. <span class="remark">&dagger;</span> The number formatter code was copied from <a href="https://code.google.com/p/javascript-number-formatter/">javascript-number-formatter</a> (<a href="http://opensource.org/licenses/mit-license.php">MIT</a>) - now forked on <a href="https://github.com/Mottie/javascript-number-formatter">GitHub</a> (<a href="https://mottie.github.io/javascript-number-formatter/">updated demo</a>).
</div> </div>
</td> </td>
</tr> </tr>
@ -529,6 +538,23 @@ math_rowFilter : ':visible:not(.filtered)'</pre>
</table> </table>
</div> </div>
<h3><a href="#">Methods</a></h3>
<div>
<h3>Recalculate</h3>
<blockquote>
Recalculate the values of all math cells within the table using the following method:
<pre class="prettyprint lang-js">$('table').trigger('recalculate');</pre>
<p>The triggered <code>'recalculate'</code> method can be renamed by modifying the <a class="intlink" href="#math_event"><code>math_event</code> option.</a></p>
This method is automatically called:
<ul>
<li>Tablesorter initialization.</li>
<li>After any call to a tablesorter method which updates the internal cache (e.g. "update", "updateCell", etc). The math widget listens for the <a href="index.html#updatecomplete">updateComplete</a> event, which occurs after the internal cache has completed updating, before recalculating values.</li>
<li>After a "filterReset".</li>
<li>And after a "filterEnd" event, <em>or</em> a "pagerComplete" event (if the pager is being used), but not both!</li>
</ul>
</blockquote>
</div>
<h3><a href="#">Attribute Settings</a></h3> <h3><a href="#">Attribute Settings</a></h3>
<div> <div>
The math widget data-attibute setting requires two parts: type &amp; formula The math widget data-attibute setting requires two parts: type &amp; formula
@ -623,6 +649,14 @@ $.tablesorter.formatMask('$#,##0.00 USD', 12345.678, 'prefix ', ' suffix');
</li> </li>
</ul> </ul>
<p>
<span class="label label-info">Note</span> The difference between using <code>#</code> and <code>0</code> in the mask, is that when a value of zero is passed to the function, the <code>#</code> mask will return an empty string whereas the <code>0</code> mask will return a zero.
<pre class="prettyprint lang-js">$.tablesorter.formatMask('$#,##0.00 USD', 0); // result: "$0.00 USD"
$.tablesorter.formatMask('$#,###.00 USD', 0); // result: "$.00 USD"
$.tablesorter.formatMask('$#,###.#0 USD', 0); // result: "$.00 USD"
$.tablesorter.formatMask('$#,###.## USD', 0); // result: "$ USD"</pre>
</p>
<h4>Experiment with the mask:</h4> <h4>Experiment with the mask:</h4>
<textarea class="source">$#,##0.00 USD <textarea class="source">$#,##0.00 USD
##.000,00 ¥ ##.000,00 ¥

View File

@ -65,8 +65,8 @@
<script id="js">$( function() { <script id="js">$( function() {
// settings work for all three demos // settings work for first three demos
$( 'table' ).tablesorter({ $( '#table1, #table2, #table3' ).tablesorter({
widgets: [ 'sortTbody', 'filter', 'zebra' ], widgets: [ 'sortTbody', 'filter', 'zebra' ],
widgetOptions: { widgetOptions: {
sortTbody_primaryRow : '.main', sortTbody_primaryRow : '.main',
@ -78,6 +78,19 @@
} }
}); });
// locked headers demo
$( '#table4' ).tablesorter({
widgets: [ 'sortTbody', 'filter', 'zebra' ],
widgetOptions: {
sortTbody_lockHead : true,
sortTbody_primaryRow : '.main',
sortTbody_sortRows : true,
// include child row content while filtering the second demo table
filter_childRows : true
}
});
// toggle rows in first two demos // toggle rows in first two demos
$( '#table1, #table2' ).find( '.main' ).on( 'click', function() { $( '#table1, #table2' ).find( '.main' ).on( 'click', function() {
// hide other rows when clicking on primary row // hide other rows when clicking on primary row
@ -111,6 +124,7 @@
<h3 id="notes"><a href="#">Notes</a></h3> <h3 id="notes"><a href="#">Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.27.9</span>, added `sortTbody_lockHead` option. Thanks to <a href="https://github.com/ChrisM-Rogers">Chris Rogers</a>!</li>
<li>This widget (<span class="version">v2.22.2</span>) allows the sorting of tbodies (not rows) based on a specified row set by the <code>sortTbody_primaryRow</code> option.</li> <li>This widget (<span class="version">v2.22.2</span>) allows the sorting of tbodies (not rows) based on a specified row set by the <code>sortTbody_primaryRow</code> option.</li>
<li>This widget replaces the <a href="index.html#cssinfoblock"><code>cssInfoBlock</code></a> setting: <li>This widget replaces the <a href="index.html#cssinfoblock"><code>cssInfoBlock</code></a> setting:
<ul> <ul>
@ -155,6 +169,17 @@
</thead> </thead>
<tbody> <tbody>
<tr id="sorttbody-lockhead">
<td><a href="#" class="permalink">sortTbody_lockHead</a></td>
<td>false</td>
<td>When <code>true</code>, the primary row will be moved to the top of the sorted tbody.
<div class="collapsible">
<br>
Setting this option will also require setting the <code>sortTbody_sortRows</code> option to <code>true</code>. See the <a href="#lock-headers">Sort tbodies and lock the header (primary) row</a> demo below.
</div>
</td>
</tr>
<tr id="sorttbody-primaryrow"> <tr id="sorttbody-primaryrow">
<td><a href="#" class="permalink">sortTbody_primaryRow</a></td> <td><a href="#" class="permalink">sortTbody_primaryRow</a></td>
<td>null</td> <td>null</td>
@ -165,7 +190,7 @@
<p>In these demos, all primary rows have a class name of <code>"main"</code>, so this option is then set as follows:</p> <p>In these demos, all primary rows have a class name of <code>"main"</code>, so this option is then set as follows:</p>
<pre class="prettyprint lang-js">sortTbody_primaryRow : '.main'</pre> <pre class="prettyprint lang-js">sortTbody_primaryRow : '.main'</pre>
<p><span class="label label-info">*NOTE*</span> This will accept any jQuery selector, so it is possible to target multiple classes <code>'.main, .primary'</code>, but only the first found cell in the sorted column will be used when sorting the tbody.</p> <p><span class="label label-info">*NOTE*</span> This will accept any jQuery selector, so it is possible to target multiple classes <code>'.main, .primary'</code>, but only the first found cell in the sorted column will be used when sorting the tbody.</p>
<p><span class="label warning">*WARNING*</span> This widget was not designed to deal with <code>colspan</code> or <code>rowspan</code> within the primary row, so it is best to avoid them.</p> <span class="label warning">*WARNING*</span> This widget was not designed to deal with <code>colspan</code> or <code>rowspan</code> within the primary row, so it is best to avoid them.
</div> </div>
</td> </td>
</tr> </tr>
@ -344,6 +369,52 @@
<tr><td>20</td><td>975</td><td>Aisha</td><td>Badertscher</td><td>CT</td><td>mi nec massa</td></tr> <tr><td>20</td><td>975</td><td>Aisha</td><td>Badertscher</td><td>CT</td><td>mi nec massa</td></tr>
</tbody> </tbody>
</table> </table>
<br>
<hr id="lock-headers">
<!--
***********************************
TABLE 4 DEMO
*********************************** -->
<table id="table4" class="tablesorter-blue">
<caption>Sort tbodies and lock the header (primary) row</caption>
<thead>
<tr><th>Dealer</th><th>Jan</th><th>Feb</th><th>Mar</th><th>Apr</th><th>May</th><th>Jun</th><th>Jul</th><th>Aug</th><th>Sep</th><th>Oct</th><th>Nov</th><th>Dec</th></tr>
</thead>
<tbody>
<tr class="main"><td> Dealer 48 </td><td>Jan</td><td>Feb</td><td>Mar</td><td>Apr</td><td>May</td><td>Jun</td><td>Jul</td><td>Aug</td><td>Sep</td><td>Oct</td><td>Nov</td><td>Dec</td></tr>
<tr><td>Site 3</td><td>77</td><td>84</td><td>197</td><td>33</td><td>136</td><td>166</td><td>158</td><td>58</td><td>170</td><td>154</td><td>92</td><td>25</td></tr>
<tr><td>Site 18</td><td>151</td><td>187</td><td>112</td><td>91</td><td>155</td><td>74</td><td>81</td><td>92</td><td>52</td><td>140</td><td>3</td><td>109</td></tr>
<tr><td>Site 25</td><td>177</td><td>24</td><td>125</td><td>168</td><td>116</td><td>122</td><td>123</td><td>141</td><td>13</td><td>10</td><td>41</td><td>66</td></tr>
<tr><td>Site 4</td><td>131</td><td>46</td><td>188</td><td>56</td><td>37</td><td>162</td><td>160</td><td>178</td><td>73</td><td>39</td><td>99</td><td>165</td></tr>
<tr><td>Site 20</td><td>87</td><td>20</td><td>65</td><td>61</td><td>87</td><td>139</td><td>17</td><td>159</td><td>75</td><td>108</td><td>119</td><td>171</td></tr>
</tbody>
<tbody>
<tr class="main"><td> Dealer 29 </td><td>Jan</td><td>Feb</td><td>Mar</td><td>Apr</td><td>May</td><td>Jun</td><td>Jul</td><td>Aug</td><td>Sep</td><td>Oct</td><td>Nov</td><td>Dec</td></tr>
<tr><td>Site 3</td><td>45</td><td>25</td><td>188</td><td>12</td><td>131</td><td>63</td><td>189</td><td>150</td><td>63</td><td>57</td><td>50</td><td>189</td></tr>
<tr><td>Site 18</td><td>122</td><td>6</td><td>121</td><td>169</td><td>90</td><td>131</td><td>65</td><td>74</td><td>188</td><td>78</td><td>180</td><td>82</td></tr>
<tr><td>Site 25</td><td>72</td><td>151</td><td>83</td><td>38</td><td>121</td><td>2</td><td>35</td><td>54</td><td>92</td><td>113</td><td>185</td><td>38</td></tr>
<tr><td>Site 4</td><td>79</td><td>62</td><td>53</td><td>173</td><td>18</td><td>1</td><td>93</td><td>9</td><td>58</td><td>48</td><td>57</td><td>129</td></tr>
<tr><td>Site 20</td><td>33</td><td>51</td><td>175</td><td>104</td><td>125</td><td>123</td><td>1</td><td>56</td><td>66</td><td>159</td><td>84</td><td>117</td></tr>
</tbody>
<tbody>
<tr class="main"><td> Dealer 62 </td><td>Jan</td><td>Feb</td><td>Mar</td><td>Apr</td><td>May</td><td>Jun</td><td>Jul</td><td>Aug</td><td>Sep</td><td>Oct</td><td>Nov</td><td>Dec</td></tr>
<tr><td>Site 3</td><td>85</td><td>56</td><td>168</td><td>78</td><td>115</td><td>104</td><td>8</td><td>151</td><td>144</td><td>20</td><td>105</td><td>60</td></tr>
<tr><td>Site 18</td><td>189</td><td>28</td><td>76</td><td>88</td><td>16</td><td>97</td><td>194</td><td>144</td><td>31</td><td>47</td><td>192</td><td>176</td></tr>
<tr><td>Site 25</td><td>156</td><td>145</td><td>132</td><td>81</td><td>193</td><td>130</td><td>102</td><td>9</td><td>196</td><td>48</td><td>99</td><td>37</td></tr>
<tr><td>Site 4</td><td>154</td><td>5</td><td>31</td><td>58</td><td>31</td><td>119</td><td>184</td><td>32</td><td>9</td><td>169</td><td>87</td><td>46</td></tr>
<tr><td>Site 20</td><td>13</td><td>19</td><td>41</td><td>82</td><td>174</td><td>48</td><td>177</td><td>157</td><td>19</td><td>134</td><td>85</td><td>176</td></tr>
</tbody>
<tbody>
<tr class="main"><td> Dealer 25 </td><td>Jan</td><td>Feb</td><td>Mar</td><td>Apr</td><td>May</td><td>Jun</td><td>Jul</td><td>Aug</td><td>Sep</td><td>Oct</td><td>Nov</td><td>Dec</td></tr>
<tr><td>Site 3</td><td>175</td><td>58</td><td>196</td><td>186</td><td>88</td><td>46</td><td>4</td><td>109</td><td>187</td><td>167</td><td>109</td><td>104</td></tr>
<tr><td>Site 18</td><td>109</td><td>2</td><td>53</td><td>170</td><td>163</td><td>116</td><td>36</td><td>125</td><td>43</td><td>57</td><td>179</td><td>194</td></tr>
<tr><td>Site 25</td><td>109</td><td>13</td><td>169</td><td>41</td><td>166</td><td>20</td><td>38</td><td>175</td><td>69</td><td>180</td><td>176</td><td>8</td></tr>
<tr><td>Site 4</td><td>129</td><td>28</td><td>137</td><td>61</td><td>38</td><td>70</td><td>156</td><td>200</td><td>141</td><td>178</td><td>76</td><td>70</td></tr>
<tr><td>Site 20</td><td>3</td><td>65</td><td>69</td><td>162</td><td>114</td><td>179</td><td>101</td><td>157</td><td>56</td><td>149</td><td>134</td><td>85</td></tr>
</tbody>
</table>
</div> </div>
<h1>Page Header</h1> <h1>Page Header</h1>

View File

@ -118,7 +118,7 @@
} }
#ts-view { #ts-view {
width 100%; width: 100%;
display: block; display: block;
} }

View File

@ -322,7 +322,8 @@
<li><a href="example-option-sortreset-sortrestart.html">Using sortReset &amp; sortRestart options</a> (<a href="#sortreset"><code>sortReset</code></a> &amp; <a href="#sortrestart"><code>sortRestart</code></a>).</li> <li><a href="example-option-sortreset-sortrestart.html">Using sortReset &amp; sortRestart options</a> (<a href="#sortreset"><code>sortReset</code></a> &amp; <a href="#sortrestart"><code>sortRestart</code></a>).</li>
<li><a href="example-method-sortreset.html">Resetting the entire table sort</a> (<a href="#sortreset-method"><code>sortReset</code></a> method; v2.4.7).</li> <li><a href="example-method-sortreset.html">Resetting the entire table sort</a> (<a href="#sortreset-method"><code>sortReset</code></a> method; v2.4.7).</li>
<li><a href="example-options-headers-locked.html">Lock sort order</a>.</li> <li><a href="example-options-headers-locked.html">Lock sort order</a>.</li>
<li><a href="example-options-headers.html">Disable sort</a> (<span class="version updated">v2.18.1</span>).</li> <li><a href="example-options-headers.html">Disable sort for a column</a> (<span class="version updated">v2.18.1</span>).</li>
<li><a href="example-widget-column-selector.html">Disable sort for an entire row</a> (<a href="#cssignorerow"><code>cssIgnoreRow</code></a> class; v2.18.4).</li>
</ul> </ul>
</li> </li>
<li>Modify a sort: <li>Modify a sort:
@ -460,7 +461,7 @@
<li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.25.5</span>).</li> <li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.25.5</span>).</li>
<li><a href="example-widget-current-sort.html">Current Sort Widget</a> (<span class="version">v2.27.0</span>).</li> <li><a href="example-widget-current-sort.html">Current Sort Widget</a> (<span class="version">v2.27.0</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a class="external" href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.24.0</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a class="external" href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.24.0</span>).</li>
<li><span class="results">&dagger;</span> Filter widget (<span class="version updated">v2.27.5</span>): <li><span class="results">&dagger;</span> Filter widget (<span class="version updated">v2.28.0</span>):
<ul> <ul>
<li><a href="example-widget-filter.html">basic</a> (v2.0.18; <span class="version updated">v2.26.6</span>).</li> <li><a href="example-widget-filter.html">basic</a> (v2.0.18; <span class="version updated">v2.26.6</span>).</li>
<li><a href="example-widget-filter-any-match.html">external option (match any column)</a> (<span class="version">v2.13.3</span>; <span class="version updated">v2.27.5</span>).</li> <li><a href="example-widget-filter-any-match.html">external option (match any column)</a> (<span class="version">v2.13.3</span>; <span class="version updated">v2.27.5</span>).</li>
@ -479,21 +480,21 @@
<li>Grouping rows widget: <li>Grouping rows widget:
<ul> <ul>
<li><a href="example-widget-grouping.html">basic</a> (v2.8; <span class="version updated">v2.27.6</span>).</li> <li><a href="example-widget-grouping.html">basic</a> (v2.8; <span class="version updated">v2.27.6</span>).</li>
<li><a href="example-widget-grouping-filter-childrows.html">Grouping + filter + child rows</a> (<span class="updated version">v2.15.12</span>).</li> <li><a href="example-widget-grouping-filter-childrows.html">Grouping + filter + child rows</a> (<span class="updated version">v2.28.0</span>).</li>
</ul> </ul>
</li> </li>
<li><a href="example-widget-header-titles.html">Header titles widget</a> (v2.15.6; <span class="version updated">v2.24.4</span>).</li> <li><a href="example-widget-header-titles.html">Header titles widget</a> (v2.15.6; <span class="version updated">v2.24.4</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-widget-lazyload.html">Lazyload widget</a> (<span class="version">v2.24.0</span>; <span class="version updated">v2.25.7</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-widget-lazyload.html">Lazyload widget</a> (<span class="version">v2.24.0</span>; <span class="version updated">v2.25.7</span>).</li>
<li><a href="example-widget-mark.html">Mark widget</a> (<span class="version">v2.27.6</span>).</li> <li><a href="example-widget-mark.html">Mark widget</a> (<span class="version">v2.27.6</span>).</li>
<li><a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.27.0</span>).</li> <li><a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.28.0</span>).</li>
<li> <li>
<a href="example-widget-output.html">Output widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.27.0</span>). <a href="example-widget-output.html">Output widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.27.0</span>).
<br><br> <br><br>
</li> </li>
<li>Pager plugin (<a href="example-pager.html">basic</a> &amp; <a href="example-pager-ajax.html">ajax</a> demos; <span class="version updated">v2.27.7</span>).</li> <li>Pager plugin (<a href="example-pager.html">basic</a> &amp; <a href="example-pager-ajax.html">ajax</a> demos; <span class="version updated">v2.28.0</span>).</li>
<li> <li>
Pager widget (<a href="example-widget-pager.html">basic</a> &amp; <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.27.7</span>).<br> Pager widget (<a href="example-widget-pager.html">basic</a> &amp; <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.28.0</span>).<br>
<br> <br>
</li> </li>
@ -504,7 +505,7 @@
<li><span class="results">&dagger;</span> <a href="example-widget-savesort.html">Save sort widget</a> (v2.0.27; <span class="version updated">v2.24.0</span>).</li> <li><span class="results">&dagger;</span> <a href="example-widget-savesort.html">Save sort widget</a> (v2.0.27; <span class="version updated">v2.24.0</span>).</li>
<li><a href="example-widget-scroller.html">Scroller widget</a> (<span class="version">v2.9</span>; <span class="version updated">v2.27.0</span>).</li> <li><a href="example-widget-scroller.html">Scroller widget</a> (<span class="version">v2.9</span>; <span class="version updated">v2.27.0</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-widget-sort-to-hash.html">Sort-to-hash widget</a> (<span class="version">v2.22.4</span>; <span class="version updated">v2.24.4</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-widget-sort-to-hash.html">Sort-to-hash widget</a> (<span class="version">v2.22.4</span>; <span class="version updated">v2.24.4</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-widget-sort-tbodies.html">Sort tbodies widget</a> (<span class="version">v2.22.2</span>; <span class="version updated">v2.24.6</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-widget-sort-tbodies.html">Sort tbodies widget</a> (<span class="version">v2.22.2</span>; <span class="version updated">v2.28.0</span>).</li>
<li><a href="example-widget-static-row.html">Static row widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.24.0</span>).</li> <li><a href="example-widget-static-row.html">Static row widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.24.0</span>).</li>
<li><span class="results">&dagger;</span> <a href="example-widget-sticky-header.html">Sticky header widget</a> (v2.0.21.1; <span class="version updated">v2.27.0</span>).</li> <li><span class="results">&dagger;</span> <a href="example-widget-sticky-header.html">Sticky header widget</a> (v2.0.21.1; <span class="version updated">v2.27.0</span>).</li>
@ -853,7 +854,7 @@
<td>Class name to add to a table header row if you want all cells within this row to be ignored (<span class="version">v2.18.4</span>). <td>Class name to add to a table header row if you want all cells within this row to be ignored (<span class="version">v2.18.4</span>).
<div class="collapsible"> <div class="collapsible">
<br> <br>
Header rows with this class name will not be added into the <a href="#variable-headers"><code>table.config.$headers</code></a> variable.<br> Header rows with this class name will not be added into the <a href="#variable-headers"><code>table.config.$headers</code></a> variable. Meaning, any cells in the row will have sorting disabled, and any form element interaction within these cells will also be ignored by tablesorter.<br>
<br> <br>
This class name should be added to header rows that contain custom HTML, like for the pager controls, custom filter row or table toolbar. This class name should be added to header rows that contain custom HTML, like for the pager controls, custom filter row or table toolbar.
</div> </div>
@ -1260,8 +1261,10 @@ From the example function above, you'll end up with something similar to this HT
<td>null</td> <td>null</td>
<td>Use to add an additional forced sort that is <strong>prepended</strong> to <a href="#sortlist"><code>sortList</code></a>. <td>Use to add an additional forced sort that is <strong>prepended</strong> to <a href="#sortlist"><code>sortList</code></a>.
<div class="collapsible"> <div class="collapsible">
<br> <p>
For example, <code>sortForce: [[0,0]]</code> will sort the first column in ascending order. After the forced sort, the user selected column(s), or during initialzation, the sorting order defined in the sortList will follow. And lastly, the sort defined in the <a href="#sortappend"><code>sortAppend</code></a> option will be applied. More explicitly:<br> <span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
For example, <code>sortForce: [[0,0]]</code> will sort the first column in ascending order. After the forced sort, the user selected column(s), <em>but not during initialzation</em>, the sorting order defined in the sortList will follow. And lastly, the sort defined in the <a href="#sortappend"><code>sortAppend</code></a> option will be applied. More explicitly:<br>
<br> <br>
There are three options to determine the sort order and this is the order of priority: There are three options to determine the sort order and this is the order of priority:
<ol> <ol>
@ -1287,7 +1290,9 @@ From the example function above, you'll end up with something similar to this HT
<td>null</td> <td>null</td>
<td>Use to add an initial sort to the table. <td>Use to add an initial sort to the table.
<div class="collapsible"> <div class="collapsible">
<br> <p>
<span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
The value contains an array of instructions for per-column sorting and direction in the format: <code>[[columnIndex, sortDirection], ... ]</code> where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: <code>[[0,0],[1,0]]</code>. Please see <a href="#sortforce"><code>sortForce</code></a> for more details on other sort order options.<br> The value contains an array of instructions for per-column sorting and direction in the format: <code>[[columnIndex, sortDirection], ... ]</code> where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: <code>[[0,0],[1,0]]</code>. Please see <a href="#sortforce"><code>sortForce</code></a> for more details on other sort order options.<br>
<pre class="prettyprint lang-js">$(function(){ <pre class="prettyprint lang-js">$(function(){
$("table").tablesorter({ $("table").tablesorter({
@ -1315,7 +1320,9 @@ From the example function above, you'll end up with something similar to this HT
<td>null</td> <td>null</td>
<td>Use to add an additional forced sort that will be appended to the dynamic selections by the user (<span class="version updated">v2.24.0</span>). <td>Use to add an additional forced sort that will be appended to the dynamic selections by the user (<span class="version updated">v2.24.0</span>).
<div class="collapsible"> <div class="collapsible">
<br> <p>
<span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
For example, can be used to sort people alphabetically after some other user-selected sort that results in rows with the same value like dates or money due. It can help prevent data from appearing as though it has a random secondary sort.<br> For example, can be used to sort people alphabetically after some other user-selected sort that results in rows with the same value like dates or money due. It can help prevent data from appearing as though it has a random secondary sort.<br>
<pre class="prettyprint lang-js">$(function(){ <pre class="prettyprint lang-js">$(function(){
$("table").tablesorter({ $("table").tablesorter({

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 09-28-2016 (v2.27.8)*/ /*! tablesorter (FORK) - updated 11-26-2016 (v2.28.0)*/
/* 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) {
@ -16,7 +16,7 @@
} }
}(function(jQuery) { }(function(jQuery) {
/*! TableSorter (FORK) v2.27.8 *//* /*! TableSorter (FORK) v2.28.0 *//*
* Client-side table sorting with ease! * Client-side table sorting with ease!
* @requires jQuery v1.2.6+ * @requires jQuery v1.2.6+
* *
@ -40,7 +40,7 @@
'use strict'; 'use strict';
var ts = $.tablesorter = { var ts = $.tablesorter = {
version : '2.27.8', version : '2.28.0',
parsers : [], parsers : [],
widgets : [], widgets : [],
@ -134,7 +134,11 @@
headerList: [], headerList: [],
empties: {}, empties: {},
strings: {}, strings: {},
parsers: [] parsers: [],
// *** parser options for validator; values must be falsy!
globalize: 0,
imgAttr: 0
// removed: widgetZebra: { css: ['even', 'odd'] } // removed: widgetZebra: { css: ['even', 'odd'] }
@ -308,6 +312,7 @@
ts.setupParsers( c ); ts.setupParsers( c );
// start total row count at zero // start total row count at zero
c.totalRows = 0; c.totalRows = 0;
ts.validateOptions( c );
// build the cache for the tbody cells // build the cache for the tbody cells
// delayInit will delay building the cache until the user starts a sort // delayInit will delay building the cache until the user starts a sort
if ( !c.delayInit ) { ts.buildCache( c ); } if ( !c.delayInit ) { ts.buildCache( c ); }
@ -441,9 +446,11 @@
e.stopPropagation(); e.stopPropagation();
// remove all widgets // remove all widgets
ts.removeWidget( this, true, false ); ts.removeWidget( this, true, false );
var tmp = $.extend( true, {}, c.originalSettings );
// restore original settings; this clears out current settings, but does not clear // restore original settings; this clears out current settings, but does not clear
// values saved to storage. // values saved to storage.
c = $.extend( true, ts.defaults, c.originalSettings ); c = $.extend( true, ts.defaults, tmp );
c.originalSettings = tmp;
this.hasInitialized = false; this.hasInitialized = false;
// setup the entire table again // setup the entire table again
ts.setup( this, c ); ts.setup( this, c );
@ -1086,6 +1093,7 @@
.removeClass( css.join( ' ' ) ); .removeClass( css.join( ' ' ) );
// remove all header information // remove all header information
c.$headers c.$headers
.add( $( 'thead ' + c.namespace + '_extra_headers' ) )
.removeClass( css.join( ' ' ) ) .removeClass( css.join( ' ' ) )
.addClass( none ) .addClass( none )
.attr( 'aria-sort', 'none' ) .attr( 'aria-sort', 'none' )
@ -1928,6 +1936,8 @@
widget = ts.getWidgetById( c.widgets[ indx ] ); widget = ts.getWidgetById( c.widgets[ indx ] );
if ( widget && widget.options ) { if ( widget && widget.options ) {
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions ); c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
// add widgetOptions to defaults for option validator
$.extend( true, ts.defaults.widgetOptions, widget.options );
} }
} }
} }
@ -2300,7 +2310,9 @@
}, },
getColumnData : function( table, obj, indx, getCell, $headers ) { getColumnData : function( table, obj, indx, getCell, $headers ) {
if ( typeof obj === 'undefined' || obj === null ) { return; } if ( typeof obj !== 'object' || obj === null ) {
return obj;
}
table = $( table )[ 0 ]; table = $( table )[ 0 ];
var $header, key, var $header, key,
c = table.config, c = table.config,
@ -2411,6 +2423,34 @@
return str; return str;
}, },
validateOptions : function( c ) {
var setting, setting2, typ, timer,
// ignore options containing an array
ignore = 'sortForce sortList sortAppend widgets'.split( ' ' ),
orig = c.originalSettings;
if ( orig ) {
if ( c.debug ) {
timer = new Date();
}
for ( setting in orig ) {
typ = typeof ts.defaults[setting];
if ( typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '" option not recognized' );
} else if ( typ === 'object' ) {
for ( setting2 in orig[setting] ) {
typ = typeof ts.defaults[setting][setting2];
if ( $.inArray( setting, ignore ) < 0 && typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '.' + setting2 + '" option not recognized' );
}
}
}
}
if ( c.debug ) {
console.log( 'validate options time:' + ts.benchmark( timer ) );
}
}
},
// restore headers // restore headers
restoreHeaders : function( table ) { restoreHeaders : function( table ) {
var index, $cell, var index, $cell,
@ -2771,7 +2811,7 @@
})( jQuery ); })( jQuery );
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
/*global JSON:false */ /*global JSON:false */
;(function ($, window, document) { ;(function ($, window, document) {
'use strict'; 'use strict';
@ -2816,6 +2856,17 @@
url = options && options.url || url = options && options.url ||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') || $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname; wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
// update defaults for validator; these values must be falsy!
$.extend(true, ts.defaults, {
fixedUrl: '',
widgetOptions: {
storage_fixedUrl: '',
storage_group: '',
storage_page: '',
storage_tableId: '',
storage_useSessionStorage: ''
}
});
// https://gist.github.com/paulirish/5558557 // https://gist.github.com/paulirish/5558557
if (storageType in window) { if (storageType in window) {
try { try {
@ -3137,7 +3188,7 @@
})(jQuery); })(jQuery);
/*! Widget: filter - updated 9/23/2016 (v2.27.7) *//* /*! Widget: filter - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -3966,11 +4017,15 @@
// include change for select - fixes #473 // include change for select - fixes #473
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
wo.filter_liveSearch :
ts.getColumnData( table, wo.filter_liveSearch, column );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( table.config.widgetOptions.filter_initialized && if ( table.config.widgetOptions.filter_initialized &&
( event.which === tskeyCodes.enter || event.type === 'search' || ( event.which === tskeyCodes.enter || event.type === 'search' ||
( event.type === 'change' || event.type === 'input' ) && ( event.type === 'change' ||
( event.type === 'input' && liveSearch === true ) ) &&
this.value !== c.lastSearch[column] ) this.value !== c.lastSearch[column] )
) { ) {
event.preventDefault(); event.preventDefault();

View File

@ -1,4 +1,4 @@
/*! TableSorter (FORK) v2.27.8 *//* /*! TableSorter (FORK) v2.28.0 *//*
* Client-side table sorting with ease! * Client-side table sorting with ease!
* @requires jQuery v1.2.6+ * @requires jQuery v1.2.6+
* *
@ -22,7 +22,7 @@
'use strict'; 'use strict';
var ts = $.tablesorter = { var ts = $.tablesorter = {
version : '2.27.8', version : '2.28.0',
parsers : [], parsers : [],
widgets : [], widgets : [],
@ -116,7 +116,11 @@
headerList: [], headerList: [],
empties: {}, empties: {},
strings: {}, strings: {},
parsers: [] parsers: [],
// *** parser options for validator; values must be falsy!
globalize: 0,
imgAttr: 0
// removed: widgetZebra: { css: ['even', 'odd'] } // removed: widgetZebra: { css: ['even', 'odd'] }
@ -290,6 +294,7 @@
ts.setupParsers( c ); ts.setupParsers( c );
// start total row count at zero // start total row count at zero
c.totalRows = 0; c.totalRows = 0;
ts.validateOptions( c );
// build the cache for the tbody cells // build the cache for the tbody cells
// delayInit will delay building the cache until the user starts a sort // delayInit will delay building the cache until the user starts a sort
if ( !c.delayInit ) { ts.buildCache( c ); } if ( !c.delayInit ) { ts.buildCache( c ); }
@ -423,9 +428,11 @@
e.stopPropagation(); e.stopPropagation();
// remove all widgets // remove all widgets
ts.removeWidget( this, true, false ); ts.removeWidget( this, true, false );
var tmp = $.extend( true, {}, c.originalSettings );
// restore original settings; this clears out current settings, but does not clear // restore original settings; this clears out current settings, but does not clear
// values saved to storage. // values saved to storage.
c = $.extend( true, ts.defaults, c.originalSettings ); c = $.extend( true, ts.defaults, tmp );
c.originalSettings = tmp;
this.hasInitialized = false; this.hasInitialized = false;
// setup the entire table again // setup the entire table again
ts.setup( this, c ); ts.setup( this, c );
@ -1068,6 +1075,7 @@
.removeClass( css.join( ' ' ) ); .removeClass( css.join( ' ' ) );
// remove all header information // remove all header information
c.$headers c.$headers
.add( $( 'thead ' + c.namespace + '_extra_headers' ) )
.removeClass( css.join( ' ' ) ) .removeClass( css.join( ' ' ) )
.addClass( none ) .addClass( none )
.attr( 'aria-sort', 'none' ) .attr( 'aria-sort', 'none' )
@ -1910,6 +1918,8 @@
widget = ts.getWidgetById( c.widgets[ indx ] ); widget = ts.getWidgetById( c.widgets[ indx ] );
if ( widget && widget.options ) { if ( widget && widget.options ) {
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions ); c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
// add widgetOptions to defaults for option validator
$.extend( true, ts.defaults.widgetOptions, widget.options );
} }
} }
} }
@ -2282,7 +2292,9 @@
}, },
getColumnData : function( table, obj, indx, getCell, $headers ) { getColumnData : function( table, obj, indx, getCell, $headers ) {
if ( typeof obj === 'undefined' || obj === null ) { return; } if ( typeof obj !== 'object' || obj === null ) {
return obj;
}
table = $( table )[ 0 ]; table = $( table )[ 0 ];
var $header, key, var $header, key,
c = table.config, c = table.config,
@ -2393,6 +2405,34 @@
return str; return str;
}, },
validateOptions : function( c ) {
var setting, setting2, typ, timer,
// ignore options containing an array
ignore = 'headers sortForce sortList sortAppend widgets'.split( ' ' ),
orig = c.originalSettings;
if ( orig ) {
if ( c.debug ) {
timer = new Date();
}
for ( setting in orig ) {
typ = typeof ts.defaults[setting];
if ( typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '" option not recognized' );
} else if ( typ === 'object' ) {
for ( setting2 in orig[setting] ) {
typ = ts.defaults[setting] && typeof ts.defaults[setting][setting2];
if ( $.inArray( setting, ignore ) < 0 && typ === 'undefined' ) {
console.warn( 'Tablesorter Warning! "table.config.' + setting + '.' + setting2 + '" option not recognized' );
}
}
}
}
if ( c.debug ) {
console.log( 'validate options time:' + ts.benchmark( timer ) );
}
}
},
// restore headers // restore headers
restoreHeaders : function( table ) { restoreHeaders : function( table ) {
var index, $cell, var index, $cell,

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 09-28-2016 (v2.27.8)*/ /*! tablesorter (FORK) - updated 11-26-2016 (v2.28.0)*/
/* 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) {
@ -16,7 +16,7 @@
} }
}(function(jQuery) { }(function(jQuery) {
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
/*global JSON:false */ /*global JSON:false */
;(function ($, window, document) { ;(function ($, window, document) {
'use strict'; 'use strict';
@ -61,6 +61,17 @@
url = options && options.url || url = options && options.url ||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') || $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname; wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
// update defaults for validator; these values must be falsy!
$.extend(true, ts.defaults, {
fixedUrl: '',
widgetOptions: {
storage_fixedUrl: '',
storage_group: '',
storage_page: '',
storage_tableId: '',
storage_useSessionStorage: ''
}
});
// https://gist.github.com/paulirish/5558557 // https://gist.github.com/paulirish/5558557
if (storageType in window) { if (storageType in window) {
try { try {
@ -382,7 +393,7 @@
})(jQuery); })(jQuery);
/*! Widget: filter - updated 9/23/2016 (v2.27.7) *//* /*! Widget: filter - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -1211,11 +1222,15 @@
// include change for select - fixes #473 // include change for select - fixes #473
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
wo.filter_liveSearch :
ts.getColumnData( table, wo.filter_liveSearch, column );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( table.config.widgetOptions.filter_initialized && if ( table.config.widgetOptions.filter_initialized &&
( event.which === tskeyCodes.enter || event.type === 'search' || ( event.which === tskeyCodes.enter || event.type === 'search' ||
( event.type === 'change' || event.type === 'input' ) && ( event.type === 'change' ||
( event.type === 'input' && liveSearch === true ) ) &&
this.value !== c.lastSearch[column] ) this.value !== c.lastSearch[column] )
) { ) {
event.preventDefault(); event.preventDefault();

View File

@ -1,4 +1,4 @@
/*! Parser: two digit year - updated 11/22/2015 (v2.24.6) */ /*! Parser: two digit year - updated 11/26/2016 (v2.28.0) */
/* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */ /* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */
/*jshint jquery:true */ /*jshint jquery:true */
;(function($){ ;(function($){
@ -13,6 +13,9 @@
ts = $.tablesorter, ts = $.tablesorter,
now = new Date().getFullYear(); now = new Date().getFullYear();
// add dateRange to defaults for validator; value must be falsy
ts.defaults.dataRange = '';
if ( !ts.dates ) { ts.dates = {}; } if ( !ts.dates ) { ts.dates = {}; }
ts.dates.regxxxxyy = /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/; ts.dates.regxxxxyy = /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/;
ts.dates.regyyxxxx = /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/; ts.dates.regyyxxxx = /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/;

View File

@ -1,4 +1,4 @@
/*! Parser: input & select - updated 9/1/2016 (v2.27.6) *//* /*! Parser: input & select - updated 11/26/2016 (v2.28.0) *//*
* for jQuery 1.7+ & tablesorter 2.7.11+ * for jQuery 1.7+ & tablesorter 2.7.11+
* Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html * Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
*/ */
@ -110,6 +110,10 @@
type : 'text' type : 'text'
}); });
// update defaults for validator; values must be falsy
$.tablesorter.defaults.checkboxClass = '';
$.tablesorter.defaults.checkboxVisible = '';
// update select and all input types in the tablesorter cache when the change event fires. // update select and all input types in the tablesorter cache when the change event fires.
// This method only works with jQuery 1.7+ // This method only works with jQuery 1.7+
// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired // you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired

View File

@ -1,4 +1,4 @@
/*! Widget: Build Table - updated 3/26/2015 (v2.21.3) *//* /*! Widget: Build Table - updated 11/26/2016 (v2.28.0) *//*
* for tableSorter v2.16.0+ * for tableSorter v2.16.0+
* by Rob Garrison * by Rob Garrison
*/ */
@ -79,6 +79,9 @@
} }
}; };
// add data to defaults for validator; value must be falsy!
ts.defaults.data = '';
bt.defaults = { bt.defaults = {
// *** build widget core *** // *** build widget core ***
build_type : '', // array, csv, object, json, html build_type : '', // array, csv, object, json, html

View File

@ -1,4 +1,4 @@
/*! Widget: filter - updated 9/23/2016 (v2.27.7) *//* /*! Widget: filter - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -827,11 +827,15 @@
// include change for select - fixes #473 // include change for select - fixes #473
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
wo.filter_liveSearch :
ts.getColumnData( table, wo.filter_liveSearch, column );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( table.config.widgetOptions.filter_initialized && if ( table.config.widgetOptions.filter_initialized &&
( event.which === tskeyCodes.enter || event.type === 'search' || ( event.which === tskeyCodes.enter || event.type === 'search' ||
( event.type === 'change' || event.type === 'input' ) && ( event.type === 'change' ||
( event.type === 'input' && liveSearch === true ) ) &&
this.value !== c.lastSearch[column] ) this.value !== c.lastSearch[column] )
) { ) {
event.preventDefault(); event.preventDefault();

View File

@ -1,4 +1,4 @@
/*! Widget: grouping - updated 9/1/2016 (v2.27.6) *//* /*! Widget: grouping - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.8+ and jQuery 1.7+ * Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -234,7 +234,8 @@
if ( $.isFunction( wo.group_formatter ) ) { if ( $.isFunction( wo.group_formatter ) ) {
data.currentGroup = wo.group_formatter( ( data.group || '' ).toString(), data.column, c.table, c, wo, data ) || data.group; data.currentGroup = wo.group_formatter( ( data.group || '' ).toString(), data.column, c.table, c, wo, data ) || data.group;
} }
data.$row.before( tsg.groupHeaderHTML( c, wo, data ) ); // add first() for grouping with childRows
data.$row.first().before( tsg.groupHeaderHTML( c, wo, data ) );
if ( wo.group_saveGroups && !data.savedGroup && wo.group_collapsed && wo.group_collapsible ) { if ( wo.group_saveGroups && !data.savedGroup && wo.group_collapsed && wo.group_collapsible ) {
// all groups start collapsed; data.groupIndex is 1 more than the expected index. // all groups start collapsed; data.groupIndex is 1 more than the expected index.
wo.group_collapsedGroups[ wo.group_collapsedGroup ].push( data.currentGroup + data.groupIndex ); wo.group_collapsedGroups[ wo.group_collapsedGroup ].push( data.currentGroup + data.groupIndex );

View File

@ -1,4 +1,4 @@
/*! Widget: math - updated 7/31/2016 (v2.27.0) *//* /*! Widget: math - updated 11/26/2016 (v2.28.0) *//*
* Requires tablesorter v2.16+ and jQuery 1.7+ * Requires tablesorter v2.16+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -29,7 +29,15 @@
.split(' ').join('.tsmath '), .split(' ').join('.tsmath '),
processText : function( c, $cell ) { processText : function( c, $cell ) {
var txt = ts.getElementText( c, $cell, math.getCellIndex( $cell ) ); var tmp,
txt = ts.getElementText( c, $cell, math.getCellIndex( $cell ) ),
prefix = c.widgetOptions.math_prefix;
if ( /</.test( prefix ) ) {
// prefix contains HTML; remove it & any text before using formatFloat
tmp = $( '<div>' + prefix + '</div>' ).text()
.replace(/\{content\}/g, '').trim();
txt = txt.replace( tmp, '' );
}
txt = ts.formatFloat( txt.replace( /[^\w,. \-()]/g, '' ), c.table ) || 0; txt = ts.formatFloat( txt.replace( /[^\w,. \-()]/g, '' ), c.table ) || 0;
// isNaN('') => false // isNaN('') => false
return isNaN( txt ) ? 0 : txt; return isNaN( txt ) ? 0 : txt;
@ -352,7 +360,7 @@
prev = $cell.html(), prev = $cell.html(),
mask = $cell.attr( 'data-' + wo.math_data + '-mask' ) || wo.math_mask, mask = $cell.attr( 'data-' + wo.math_data + '-mask' ) || wo.math_mask,
target = $cell.attr( 'data-' + wo.math_data + '-target' ) || '', target = $cell.attr( 'data-' + wo.math_data + '-target' ) || '',
result = ts.formatMask( mask, value, wo.math_wrapPrefix, wo.math_wrapSuffix ); result = ts.formatMask( mask, value, wo.math_prefix, wo.math_suffix );
if (target) { if (target) {
$el = $cell.find(target); $el = $cell.find(target);
if ($el.length) { if ($el.length) {
@ -403,8 +411,7 @@
start = mask.search( /[0-9\-\+#]/ ), start = mask.search( /[0-9\-\+#]/ ),
tmp = start > 0 ? mask.substring( 0, start ) : '', tmp = start > 0 ? mask.substring( 0, start ) : '',
prefix = tmp; prefix = tmp;
if ( tmpPrefix ) {
if ( start > 0 && tmpPrefix ) {
if ( /\{content\}/.test( tmpPrefix || '' ) ) { if ( /\{content\}/.test( tmpPrefix || '' ) ) {
prefix = ( tmpPrefix || '' ).replace( /\{content\}/g, tmp || '' ); prefix = ( tmpPrefix || '' ).replace( /\{content\}/g, tmp || '' );
} else { } else {
@ -418,7 +425,7 @@
index += ( mask.substring( index, index + 1 ) === '.' ) ? 1 : 0; index += ( mask.substring( index, index + 1 ) === '.' ) ? 1 : 0;
tmp = end > 0 ? mask.substring( index, len ) : ''; tmp = end > 0 ? mask.substring( index, len ) : '';
suffix = tmp; suffix = tmp;
if ( tmp !== '' && tmpSuffix ) { if ( tmpSuffix ) {
if ( /\{content\}/.test( tmpSuffix || '' ) ) { if ( /\{content\}/.test( tmpSuffix || '' ) ) {
suffix = ( tmpSuffix || '' ).replace( /\{content\}/g, tmp || '' ); suffix = ( tmpSuffix || '' ).replace( /\{content\}/g, tmp || '' );
} else { } else {

View File

@ -1,4 +1,4 @@
/*! Widget: Pager - updated 9/23/2016 (v2.27.7) */ /*! Widget: Pager - updated 11/26/2016 (v2.28.0) */
/* Requires tablesorter v2.8+ and jQuery 1.7+ /* Requires tablesorter v2.8+ and jQuery 1.7+
* by Rob Garrison * by Rob Garrison
*/ */
@ -404,11 +404,11 @@
p.$container p.$container
.find( s.first + ',' + s.prev ) .find( s.first + ',' + s.prev )
.toggleClass( wo.pager_css.disabled, first ) .toggleClass( wo.pager_css.disabled, first )
.attr( 'aria-disabled', first ); .prop( 'aria-disabled', first );
p.$container p.$container
.find( s.next + ',' + s.last ) .find( s.next + ',' + s.last )
.toggleClass( wo.pager_css.disabled, last ) .toggleClass( wo.pager_css.disabled, last )
.attr( 'aria-disabled', last ); .prop( 'aria-disabled', last );
} }
}, },
@ -451,7 +451,7 @@
.add( p.$goto ) .add( p.$goto )
.removeClass( wo.pager_css.disabled ) .removeClass( wo.pager_css.disabled )
.removeAttr( 'disabled' ) .removeAttr( 'disabled' )
.attr( 'aria-disabled', 'false' ); .prop( 'aria-disabled', 'false' );
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method
c.totalRows = p.totalRows; c.totalRows = p.totalRows;
tsp.parsePageNumber( c, p ); tsp.parsePageNumber( c, p );
@ -1012,7 +1012,7 @@
len = $controls.length; len = $controls.length;
for ( index = 0; index < len; index++ ) { for ( index = 0; index < len; index++ ) {
$controls.eq( index ) $controls.eq( index )
.attr( 'aria-disabled', 'true' ) .prop( 'aria-disabled', 'true' )
.addClass( wo.pager_css.disabled )[ 0 ].disabled = true; .addClass( wo.pager_css.disabled )[ 0 ].disabled = true;
} }
}, },

View File

@ -1,6 +1,7 @@
/*! tablesorter tbody sorting widget (BETA) - 11/22/2015 (v2.24.6) /*! tablesorter tbody sorting widget (BETA) - 11/26/2016 (v2.28.0)
* Requires tablesorter v2.22.2+ and jQuery 1.4+ * Requires tablesorter v2.22.2+ and jQuery 1.4+
* by Rob Garrison * by Rob Garrison
* Contributors: Chris Rogers
*/ */
/*jshint browser:true, jquery:true, unused:false */ /*jshint browser:true, jquery:true, unused:false */
/*global jQuery: false */ /*global jQuery: false */
@ -38,6 +39,15 @@
// find parsers for each column // find parsers for each column
ts.sortTbodies.setTbodies( c, wo ); ts.sortTbodies.setTbodies( c, wo );
ts.updateCache( c, null, c.$tbodies ); ts.updateCache( c, null, c.$tbodies );
})
.bind('sortEnd', function() {
// Moves the head row back to the top of the tbody
var primaryRow = wo.sortTbody_primaryRow;
if ( wo.sortTbody_lockHead && primaryRow ) {
c.$table.find( primaryRow ).each( function() {
$( this ).parents( 'tbody' ).prepend( this );
});
}
}); });
// detect parsers - in case the table contains only info-only tbodies // detect parsers - in case the table contains only info-only tbodies
@ -208,6 +218,8 @@
// priority < 50 (filter widget), so c.$tbodies has the correct elements // priority < 50 (filter widget), so c.$tbodies has the correct elements
priority: 40, priority: 40,
options: { options: {
// lock primary row as a header when sorting
sortTbody_lockHead : false,
// point to a row within the tbody that matches the number of header columns // point to a row within the tbody that matches the number of header columns
sortTbody_primaryRow : null, sortTbody_primaryRow : null,
// sort tbody internal rows // sort tbody internal rows

View File

@ -1,4 +1,4 @@
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */ /*! Widget: storage - updated 11/26/2016 (v2.28.0) */
/*global JSON:false */ /*global JSON:false */
;(function ($, window, document) { ;(function ($, window, document) {
'use strict'; 'use strict';
@ -43,6 +43,17 @@
url = options && options.url || url = options && options.url ||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') || $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname; wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
// update defaults for validator; these values must be falsy!
$.extend(true, ts.defaults, {
fixedUrl: '',
widgetOptions: {
storage_fixedUrl: '',
storage_group: '',
storage_page: '',
storage_tableId: '',
storage_useSessionStorage: ''
}
});
// https://gist.github.com/paulirish/5558557 // https://gist.github.com/paulirish/5558557
if (storageType in window) { if (storageType in window) {
try { try {

View File

@ -1,7 +1,7 @@
{ {
"name": "tablesorter", "name": "tablesorter",
"title": "tablesorter", "title": "tablesorter",
"version": "2.27.8", "version": "2.28.0",
"description": "tablesorter (FORK) is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.", "description": "tablesorter (FORK) is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.",
"author": { "author": {
"name": "Christian Bach", "name": "Christian Bach",

View File

@ -1,7 +1,7 @@
{ {
"name": "tablesorter", "name": "tablesorter",
"title": "tablesorter", "title": "tablesorter",
"version": "2.27.8", "version": "2.28.0",
"description": "tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.\n\nThis forked version adds lots of new enhancements including: alphanumeric sorting, pager callback functons, multiple widgets providing column styling, ui theme application, sticky headers, column filters and resizer, as well as extended documentation with a lot more demos.", "description": "tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.\n\nThis forked version adds lots of new enhancements including: alphanumeric sorting, pager callback functons, multiple widgets providing column styling, ui theme application, sticky headers, column filters and resizer, as well as extended documentation with a lot more demos.",
"author": { "author": {
"name": "Christian Bach", "name": "Christian Bach",