jquery-tablesorter 1.18.3 → 1.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +65 -38
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +9 -11
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +56 -27
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +55 -26
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f25b2d1c32020eb01d61f3b5b36078ea6c6ac85
|
4
|
+
data.tar.gz: 3d8e1b92751a59e9f79aaa7989bd0303fec33118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2abcb7450f22141441bb95ca5044426d0041d3430e2fb96a5fd6421ee2fc5ce0e45798d253366c7a4641a0e3735c94ba28b0bbe45a55ff0978ae323864fc0198
|
7
|
+
data.tar.gz: c7ec726ac20494eceb26014dcfb791b47c256ee8f6ffe86a6765ccae79c071c6483ea4a9832edcd95bd9a1a607e911612de52845d5d0382e2b15e69a9a94c6bc
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Simple integration of jquery-tablesorter into the asset pipeline.
|
6
6
|
|
7
|
-
Current tablesorter version: 2.23.
|
7
|
+
Current tablesorter version: 2.23.4 (9/23/2015), [documentation]
|
8
8
|
|
9
9
|
Any issue associated with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 09-
|
7
|
+
/*! tablesorter (FORK) - updated 09-23-2015 (v2.23.4)*/
|
8
8
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9
9
|
(function(factory) {
|
10
10
|
if (typeof define === 'function' && define.amd) {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
}
|
17
17
|
}(function($) {
|
18
18
|
|
19
|
-
/*! TableSorter (FORK) v2.23.
|
19
|
+
/*! TableSorter (FORK) v2.23.4 *//*
|
20
20
|
* Client-side table sorting with ease!
|
21
21
|
* @requires jQuery v1.2.6+
|
22
22
|
*
|
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
var ts = this;
|
45
45
|
|
46
|
-
ts.version = '2.23.
|
46
|
+
ts.version = '2.23.4';
|
47
47
|
|
48
48
|
ts.parsers = [];
|
49
49
|
ts.widgets = [];
|
@@ -1606,7 +1606,7 @@
|
|
1606
1606
|
|
1607
1607
|
// *** sort functions ***
|
1608
1608
|
// regex used in natural sort
|
1609
|
-
ts.regex.chunk = /(^([+\-]?(
|
1609
|
+
ts.regex.chunk = /(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi; // chunk/tokenize numbers & letters
|
1610
1610
|
ts.regex.chunks = /(^\\0|\\0$)/; // replace chunks @ ends
|
1611
1611
|
ts.regex.hex = /^0x[0-9a-f]+$/i; // hex
|
1612
1612
|
|
@@ -1810,13 +1810,12 @@
|
|
1810
1810
|
|
1811
1811
|
ts.applyWidgetOptions = function( table, c ){
|
1812
1812
|
var indx, widget,
|
1813
|
-
len = c.widgets.length
|
1814
|
-
wo = c.widgetOptions;
|
1813
|
+
len = c.widgets.length;
|
1815
1814
|
if (len) {
|
1816
1815
|
for (indx = 0; indx < len; indx++) {
|
1817
1816
|
widget = ts.getWidgetById( c.widgets[indx] );
|
1818
1817
|
if ( widget && 'options' in widget ) {
|
1819
|
-
|
1818
|
+
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
|
1820
1819
|
}
|
1821
1820
|
}
|
1822
1821
|
}
|
@@ -1826,7 +1825,6 @@
|
|
1826
1825
|
table = $(table)[0]; // in case this is called externally
|
1827
1826
|
var indx, len, names, widget, name, applied,
|
1828
1827
|
c = table.config,
|
1829
|
-
wo = c.widgetOptions,
|
1830
1828
|
tableClass = ' ' + c.table.className + ' ',
|
1831
1829
|
widgets = [],
|
1832
1830
|
time, time2, w, wd;
|
@@ -1884,14 +1882,14 @@
|
|
1884
1882
|
c.widgetInit[ name ] = true;
|
1885
1883
|
if (table.hasInitialized) {
|
1886
1884
|
// don't reapply widget options on tablesorter init
|
1887
|
-
ts.applyWidgetOptions( table,
|
1885
|
+
ts.applyWidgetOptions( table, table.config );
|
1888
1886
|
}
|
1889
1887
|
if ( 'init' in widget ) {
|
1890
1888
|
applied = true;
|
1891
1889
|
if (c.debug) {
|
1892
1890
|
console[ console.group ? 'group' : 'log' ]( 'Initializing ' + name + ' widget' );
|
1893
1891
|
}
|
1894
|
-
widget.init(table, widget,
|
1892
|
+
widget.init(table, widget, table.config, table.config.widgetOptions);
|
1895
1893
|
}
|
1896
1894
|
}
|
1897
1895
|
if ( !init && 'format' in widget ) {
|
@@ -1899,7 +1897,7 @@
|
|
1899
1897
|
if (c.debug) {
|
1900
1898
|
console[ console.group ? 'group' : 'log' ]( 'Updating ' + name + ' widget' );
|
1901
1899
|
}
|
1902
|
-
widget.format(table,
|
1900
|
+
widget.format(table, table.config, table.config.widgetOptions, false);
|
1903
1901
|
}
|
1904
1902
|
if (c.debug) {
|
1905
1903
|
if (applied) {
|
@@ -2109,7 +2107,7 @@
|
|
2109
2107
|
});
|
2110
2108
|
|
2111
2109
|
// set up debug logs
|
2112
|
-
if ( !( console && console.log ) ) {
|
2110
|
+
if ( !( window.console && window.console.log ) ) {
|
2113
2111
|
ts.logs = [];
|
2114
2112
|
/*jshint -W020 */
|
2115
2113
|
console = {};
|
@@ -2718,7 +2716,7 @@
|
|
2718
2716
|
|
2719
2717
|
})(jQuery);
|
2720
2718
|
|
2721
|
-
/*! Widget: filter - updated 9/
|
2719
|
+
/*! Widget: filter - updated 9/23/2015 (v2.23.4) *//*
|
2722
2720
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
2723
2721
|
* by Rob Garrison
|
2724
2722
|
*/
|
@@ -2741,6 +2739,7 @@
|
|
2741
2739
|
options : {
|
2742
2740
|
filter_childRows : false, // if true, filter includes child row content in the search
|
2743
2741
|
filter_childByColumn : false, // ( filter_childRows must be true ) if true = search child rows by column; false = search all child row text grouped
|
2742
|
+
filter_childWithSibs : true, // if true, include matching child row siblings
|
2744
2743
|
filter_columnFilters : true, // if true, a filter will be added to the top of each table column
|
2745
2744
|
filter_columnAnyMatch: true, // if true, allows using '#:{query}' in AnyMatch searches ( column:query )
|
2746
2745
|
filter_cellFilter : '', // css class name added to the filter cell ( string or array )
|
@@ -3077,7 +3076,7 @@
|
|
3077
3076
|
c.$table.addClass( 'hasFilters' );
|
3078
3077
|
|
3079
3078
|
// define timers so using clearTimeout won't cause an undefined error
|
3080
|
-
wo.
|
3079
|
+
wo.filter_searchTimer = null;
|
3081
3080
|
wo.filter_initTimer = null;
|
3082
3081
|
wo.filter_formatterCount = 0;
|
3083
3082
|
wo.filter_formatterInit = [];
|
@@ -3210,7 +3209,7 @@
|
|
3210
3209
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
3211
3210
|
.append( options );
|
3212
3211
|
txt = wo.filter_selectSource;
|
3213
|
-
fxn =
|
3212
|
+
fxn = typeof txt === 'function' ? true : ts.getColumnData( table, txt, column );
|
3214
3213
|
if ( fxn ) {
|
3215
3214
|
// updating so the extra options are appended
|
3216
3215
|
tsf.buildSelect( c.table, column, '', true, $header.hasClass( wo.filter_onlyAvail ) );
|
@@ -3229,7 +3228,7 @@
|
|
3229
3228
|
}
|
3230
3229
|
|
3231
3230
|
if ( wo.filter_hideFilters ) {
|
3232
|
-
tsf.hideFilters(
|
3231
|
+
tsf.hideFilters( c );
|
3233
3232
|
}
|
3234
3233
|
|
3235
3234
|
// show processing icon
|
@@ -3356,7 +3355,7 @@
|
|
3356
3355
|
return parsed ? c.parsers[column].format( filter, c.table, [], column ) : filter;
|
3357
3356
|
},
|
3358
3357
|
buildRow: function( table, c, wo ) {
|
3359
|
-
var col, column, $header,
|
3358
|
+
var col, column, $header, makeSelect, disabled, name, ffxn, tmp,
|
3360
3359
|
// c.columns defined in computeThIndexes()
|
3361
3360
|
cellFilter = wo.filter_cellFilter,
|
3362
3361
|
columns = c.columns,
|
@@ -3380,14 +3379,14 @@
|
|
3380
3379
|
// assuming last cell of a column is the main column
|
3381
3380
|
$header = c.$headerIndexed[ column ];
|
3382
3381
|
ffxn = ts.getColumnData( table, wo.filter_functions, column );
|
3383
|
-
|
3382
|
+
makeSelect = ( wo.filter_functions && ffxn && typeof ffxn !== 'function' ) ||
|
3384
3383
|
$header.hasClass( 'filter-select' );
|
3385
3384
|
// get data from jQuery data, metadata, headers option or header class name
|
3386
3385
|
col = ts.getColumnData( table, c.headers, column );
|
3387
3386
|
disabled = ts.getData( $header[0], col, 'filter' ) === 'false' ||
|
3388
3387
|
ts.getData( $header[0], col, 'parser' ) === 'false';
|
3389
3388
|
|
3390
|
-
if (
|
3389
|
+
if ( makeSelect ) {
|
3391
3390
|
buildFilter = $( '<select>' ).appendTo( c.$filters.eq( column ) );
|
3392
3391
|
} else {
|
3393
3392
|
ffxn = ts.getColumnData( table, wo.filter_formatter, column );
|
@@ -3489,10 +3488,10 @@
|
|
3489
3488
|
},
|
3490
3489
|
searching: function( table, filter, skipFirst ) {
|
3491
3490
|
var wo = table.config.widgetOptions;
|
3492
|
-
clearTimeout( wo.
|
3491
|
+
clearTimeout( wo.filter_searchTimer );
|
3493
3492
|
if ( typeof filter === 'undefined' || filter === true ) {
|
3494
3493
|
// delay filtering
|
3495
|
-
wo.
|
3494
|
+
wo.filter_searchTimer = setTimeout( function() {
|
3496
3495
|
tsf.checkFilters( table, filter, skipFirst );
|
3497
3496
|
}, wo.filter_liveSearch ? wo.filter_searchDelay : 10 );
|
3498
3497
|
} else {
|
@@ -3550,7 +3549,7 @@
|
|
3550
3549
|
return false;
|
3551
3550
|
}
|
3552
3551
|
},
|
3553
|
-
hideFilters: function(
|
3552
|
+
hideFilters: function( c ) {
|
3554
3553
|
var timer;
|
3555
3554
|
c.$table
|
3556
3555
|
.find( '.' + tscss.filterRow )
|
@@ -3627,7 +3626,7 @@
|
|
3627
3626
|
targets = wo.filter_initialized || !$input.filter( wo.filter_anyColumnSelector ).length,
|
3628
3627
|
columns = [],
|
3629
3628
|
val = $.trim( tsf.getLatestSearch( $input ).attr( 'data-column' ) || '' );
|
3630
|
-
if (
|
3629
|
+
if ( /^[0-9]+$/.test(val)) {
|
3631
3630
|
return parseInt( val, 10 );
|
3632
3631
|
}
|
3633
3632
|
// process column range
|
@@ -3841,7 +3840,7 @@
|
|
3841
3840
|
!table.config.widgetOptions.filter_initialized ) {
|
3842
3841
|
return;
|
3843
3842
|
}
|
3844
|
-
var len, norm_rows, rowData, $rows, rowIndex, tbodyIndex, $tbody, columnIndex,
|
3843
|
+
var len, norm_rows, rowData, $rows, $row, rowIndex, tbodyIndex, $tbody, columnIndex,
|
3845
3844
|
isChild, childRow, lastSearch, showRow, time, val, indx,
|
3846
3845
|
notFiltered, searchFiltered, query, injected, res, id, txt,
|
3847
3846
|
storedFilters = $.extend( [], filters ),
|
@@ -4029,24 +4028,37 @@
|
|
4029
4028
|
'';
|
4030
4029
|
}
|
4031
4030
|
|
4032
|
-
showRow =
|
4031
|
+
showRow = false;
|
4032
|
+
val = tsf.processRow( c, data, vars );
|
4033
4033
|
childRow = rowData.$row.filter( ':gt( 0 )' );
|
4034
|
-
|
4035
4034
|
if ( wo.filter_childRows && childRow.length ) {
|
4035
|
+
if ( !wo.filter_childWithSibs ) {
|
4036
|
+
// hide all child rows
|
4037
|
+
childRow.addClass( wo.filter_filteredRow );
|
4038
|
+
}
|
4036
4039
|
if ( wo.filter_childByColumn ) {
|
4037
4040
|
// cycle through each child row
|
4038
4041
|
for ( indx = 0; indx < childRow.length; indx++ ) {
|
4039
4042
|
data.$row = childRow.eq( indx );
|
4040
4043
|
data.cacheArray = rowData.child[ indx ];
|
4041
4044
|
data.rawArray = data.cacheArray;
|
4045
|
+
val = tsf.processRow( c, data, vars );
|
4042
4046
|
// use OR comparison on child rows
|
4043
|
-
showRow = showRow ||
|
4047
|
+
showRow = showRow || val;
|
4048
|
+
if ( !wo.filter_childWithSibs && val ) {
|
4049
|
+
childRow.eq( indx ).removeClass( wo.filter_filteredRow );
|
4050
|
+
}
|
4044
4051
|
}
|
4045
4052
|
}
|
4046
|
-
|
4053
|
+
} else {
|
4054
|
+
showRow = val;
|
4047
4055
|
}
|
4048
|
-
|
4049
|
-
|
4056
|
+
$row = rowData.$row;
|
4057
|
+
// if only showing resulting child row, only include parent
|
4058
|
+
if ( !wo.filter_childWithSibs ) {
|
4059
|
+
$row = $row.eq( 0 );
|
4060
|
+
}
|
4061
|
+
$row
|
4050
4062
|
.toggleClass( wo.filter_filteredRow, !showRow )[0]
|
4051
4063
|
.display = showRow ? '' : 'none';
|
4052
4064
|
}
|
@@ -4074,14 +4086,12 @@
|
|
4074
4086
|
},
|
4075
4087
|
getOptionSource: function( table, column, onlyAvail ) {
|
4076
4088
|
table = $( table )[0];
|
4077
|
-
var
|
4078
|
-
c = table.config,
|
4089
|
+
var c = table.config,
|
4079
4090
|
wo = c.widgetOptions,
|
4080
|
-
parsed = [],
|
4081
4091
|
arry = false,
|
4082
4092
|
source = wo.filter_selectSource,
|
4083
4093
|
last = c.$table.data( 'lastSearch' ) || [],
|
4084
|
-
fxn =
|
4094
|
+
fxn = typeof source === 'function' ? true : ts.getColumnData( table, source, column );
|
4085
4095
|
|
4086
4096
|
if ( onlyAvail && last[column] !== '' ) {
|
4087
4097
|
onlyAvail = false;
|
@@ -4100,11 +4110,25 @@
|
|
4100
4110
|
// custom select source function for a SPECIFIC COLUMN
|
4101
4111
|
arry = fxn( table, column, onlyAvail );
|
4102
4112
|
}
|
4113
|
+
|
4103
4114
|
if ( arry === false ) {
|
4104
4115
|
// fall back to original method
|
4105
4116
|
arry = tsf.getOptions( table, column, onlyAvail );
|
4106
4117
|
}
|
4107
4118
|
|
4119
|
+
return tsf.processOptions( table, column, arry );
|
4120
|
+
|
4121
|
+
},
|
4122
|
+
processOptions: function( table, column, arry ) {
|
4123
|
+
if ( !$.isArray( arry ) ) {
|
4124
|
+
return false;
|
4125
|
+
}
|
4126
|
+
table = $( table )[0];
|
4127
|
+
var cts, txt, indx, len,
|
4128
|
+
c = table.config,
|
4129
|
+
validColumn = typeof column !== 'undefined' && column !== null && column >= 0 && column < c.columns,
|
4130
|
+
parsed = [];
|
4131
|
+
|
4108
4132
|
// get unique elements and sort the list
|
4109
4133
|
// if $.tablesorter.sortText exists ( not in the original tablesorter ),
|
4110
4134
|
// then natural sort the list otherwise use a basic sort
|
@@ -4112,7 +4136,7 @@
|
|
4112
4136
|
return $.inArray( value, arry ) === indx;
|
4113
4137
|
});
|
4114
4138
|
|
4115
|
-
if ( c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
4139
|
+
if ( validColumn && c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
4116
4140
|
// unsorted select options
|
4117
4141
|
return arry;
|
4118
4142
|
} else {
|
@@ -4125,7 +4149,8 @@
|
|
4125
4149
|
parsed.push({
|
4126
4150
|
t : txt,
|
4127
4151
|
// check parser length - fixes #934
|
4128
|
-
p :
|
4152
|
+
p : validColumn && c.parsers && c.parsers.length &&
|
4153
|
+
c.parsers[ column ].format( txt, table, [], column ) || txt
|
4129
4154
|
});
|
4130
4155
|
}
|
4131
4156
|
|
@@ -4135,10 +4160,10 @@
|
|
4135
4160
|
// sortNatural breaks if you don't pass it strings
|
4136
4161
|
var x = a.p.toString(),
|
4137
4162
|
y = b.p.toString();
|
4138
|
-
if (
|
4163
|
+
if ( validColumn && typeof cts === 'function' ) {
|
4139
4164
|
// custom OVERALL text sorter
|
4140
4165
|
return cts( x, y, true, column, table );
|
4141
|
-
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
4166
|
+
} else if ( validColumn && typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
4142
4167
|
// custom text sorter for a SPECIFIC COLUMN
|
4143
4168
|
return cts[column]( x, y, true, column, table );
|
4144
4169
|
} else if ( ts.sortNatural ) {
|
@@ -4196,6 +4221,7 @@
|
|
4196
4221
|
if ( !table.config.cache || $.isEmptyObject( table.config.cache ) ) {
|
4197
4222
|
return;
|
4198
4223
|
}
|
4224
|
+
|
4199
4225
|
var indx, val, txt, t, $filters, $filter,
|
4200
4226
|
c = table.config,
|
4201
4227
|
wo = c.widgetOptions,
|
@@ -4211,6 +4237,7 @@
|
|
4211
4237
|
.find( 'thead' )
|
4212
4238
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
4213
4239
|
.val();
|
4240
|
+
|
4214
4241
|
// nothing included in arry ( external source ), so get the options from
|
4215
4242
|
// filter_selectSource or column data
|
4216
4243
|
if ( typeof arry === 'undefined' || arry === '' ) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! TableSorter (FORK) v2.23.
|
1
|
+
/*! TableSorter (FORK) v2.23.4 *//*
|
2
2
|
* Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
var ts = this;
|
27
27
|
|
28
|
-
ts.version = '2.23.
|
28
|
+
ts.version = '2.23.4';
|
29
29
|
|
30
30
|
ts.parsers = [];
|
31
31
|
ts.widgets = [];
|
@@ -1588,7 +1588,7 @@
|
|
1588
1588
|
|
1589
1589
|
// *** sort functions ***
|
1590
1590
|
// regex used in natural sort
|
1591
|
-
ts.regex.chunk = /(^([+\-]?(
|
1591
|
+
ts.regex.chunk = /(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi; // chunk/tokenize numbers & letters
|
1592
1592
|
ts.regex.chunks = /(^\\0|\\0$)/; // replace chunks @ ends
|
1593
1593
|
ts.regex.hex = /^0x[0-9a-f]+$/i; // hex
|
1594
1594
|
|
@@ -1792,13 +1792,12 @@
|
|
1792
1792
|
|
1793
1793
|
ts.applyWidgetOptions = function( table, c ){
|
1794
1794
|
var indx, widget,
|
1795
|
-
len = c.widgets.length
|
1796
|
-
wo = c.widgetOptions;
|
1795
|
+
len = c.widgets.length;
|
1797
1796
|
if (len) {
|
1798
1797
|
for (indx = 0; indx < len; indx++) {
|
1799
1798
|
widget = ts.getWidgetById( c.widgets[indx] );
|
1800
1799
|
if ( widget && 'options' in widget ) {
|
1801
|
-
|
1800
|
+
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
|
1802
1801
|
}
|
1803
1802
|
}
|
1804
1803
|
}
|
@@ -1808,7 +1807,6 @@
|
|
1808
1807
|
table = $(table)[0]; // in case this is called externally
|
1809
1808
|
var indx, len, names, widget, name, applied,
|
1810
1809
|
c = table.config,
|
1811
|
-
wo = c.widgetOptions,
|
1812
1810
|
tableClass = ' ' + c.table.className + ' ',
|
1813
1811
|
widgets = [],
|
1814
1812
|
time, time2, w, wd;
|
@@ -1866,14 +1864,14 @@
|
|
1866
1864
|
c.widgetInit[ name ] = true;
|
1867
1865
|
if (table.hasInitialized) {
|
1868
1866
|
// don't reapply widget options on tablesorter init
|
1869
|
-
ts.applyWidgetOptions( table,
|
1867
|
+
ts.applyWidgetOptions( table, table.config );
|
1870
1868
|
}
|
1871
1869
|
if ( 'init' in widget ) {
|
1872
1870
|
applied = true;
|
1873
1871
|
if (c.debug) {
|
1874
1872
|
console[ console.group ? 'group' : 'log' ]( 'Initializing ' + name + ' widget' );
|
1875
1873
|
}
|
1876
|
-
widget.init(table, widget,
|
1874
|
+
widget.init(table, widget, table.config, table.config.widgetOptions);
|
1877
1875
|
}
|
1878
1876
|
}
|
1879
1877
|
if ( !init && 'format' in widget ) {
|
@@ -1881,7 +1879,7 @@
|
|
1881
1879
|
if (c.debug) {
|
1882
1880
|
console[ console.group ? 'group' : 'log' ]( 'Updating ' + name + ' widget' );
|
1883
1881
|
}
|
1884
|
-
widget.format(table,
|
1882
|
+
widget.format(table, table.config, table.config.widgetOptions, false);
|
1885
1883
|
}
|
1886
1884
|
if (c.debug) {
|
1887
1885
|
if (applied) {
|
@@ -2091,7 +2089,7 @@
|
|
2091
2089
|
});
|
2092
2090
|
|
2093
2091
|
// set up debug logs
|
2094
|
-
if ( !( console && console.log ) ) {
|
2092
|
+
if ( !( window.console && window.console.log ) ) {
|
2095
2093
|
ts.logs = [];
|
2096
2094
|
/*jshint -W020 */
|
2097
2095
|
console = {};
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 09-
|
7
|
+
/*! tablesorter (FORK) - updated 09-23-2015 (v2.23.4)*/
|
8
8
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9
9
|
(function(factory) {
|
10
10
|
if (typeof define === 'function' && define.amd) {
|
@@ -372,7 +372,7 @@
|
|
372
372
|
|
373
373
|
})(jQuery);
|
374
374
|
|
375
|
-
/*! Widget: filter - updated 9/
|
375
|
+
/*! Widget: filter - updated 9/23/2015 (v2.23.4) *//*
|
376
376
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
377
377
|
* by Rob Garrison
|
378
378
|
*/
|
@@ -395,6 +395,7 @@
|
|
395
395
|
options : {
|
396
396
|
filter_childRows : false, // if true, filter includes child row content in the search
|
397
397
|
filter_childByColumn : false, // ( filter_childRows must be true ) if true = search child rows by column; false = search all child row text grouped
|
398
|
+
filter_childWithSibs : true, // if true, include matching child row siblings
|
398
399
|
filter_columnFilters : true, // if true, a filter will be added to the top of each table column
|
399
400
|
filter_columnAnyMatch: true, // if true, allows using '#:{query}' in AnyMatch searches ( column:query )
|
400
401
|
filter_cellFilter : '', // css class name added to the filter cell ( string or array )
|
@@ -731,7 +732,7 @@
|
|
731
732
|
c.$table.addClass( 'hasFilters' );
|
732
733
|
|
733
734
|
// define timers so using clearTimeout won't cause an undefined error
|
734
|
-
wo.
|
735
|
+
wo.filter_searchTimer = null;
|
735
736
|
wo.filter_initTimer = null;
|
736
737
|
wo.filter_formatterCount = 0;
|
737
738
|
wo.filter_formatterInit = [];
|
@@ -864,7 +865,7 @@
|
|
864
865
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
865
866
|
.append( options );
|
866
867
|
txt = wo.filter_selectSource;
|
867
|
-
fxn =
|
868
|
+
fxn = typeof txt === 'function' ? true : ts.getColumnData( table, txt, column );
|
868
869
|
if ( fxn ) {
|
869
870
|
// updating so the extra options are appended
|
870
871
|
tsf.buildSelect( c.table, column, '', true, $header.hasClass( wo.filter_onlyAvail ) );
|
@@ -883,7 +884,7 @@
|
|
883
884
|
}
|
884
885
|
|
885
886
|
if ( wo.filter_hideFilters ) {
|
886
|
-
tsf.hideFilters(
|
887
|
+
tsf.hideFilters( c );
|
887
888
|
}
|
888
889
|
|
889
890
|
// show processing icon
|
@@ -1010,7 +1011,7 @@
|
|
1010
1011
|
return parsed ? c.parsers[column].format( filter, c.table, [], column ) : filter;
|
1011
1012
|
},
|
1012
1013
|
buildRow: function( table, c, wo ) {
|
1013
|
-
var col, column, $header,
|
1014
|
+
var col, column, $header, makeSelect, disabled, name, ffxn, tmp,
|
1014
1015
|
// c.columns defined in computeThIndexes()
|
1015
1016
|
cellFilter = wo.filter_cellFilter,
|
1016
1017
|
columns = c.columns,
|
@@ -1034,14 +1035,14 @@
|
|
1034
1035
|
// assuming last cell of a column is the main column
|
1035
1036
|
$header = c.$headerIndexed[ column ];
|
1036
1037
|
ffxn = ts.getColumnData( table, wo.filter_functions, column );
|
1037
|
-
|
1038
|
+
makeSelect = ( wo.filter_functions && ffxn && typeof ffxn !== 'function' ) ||
|
1038
1039
|
$header.hasClass( 'filter-select' );
|
1039
1040
|
// get data from jQuery data, metadata, headers option or header class name
|
1040
1041
|
col = ts.getColumnData( table, c.headers, column );
|
1041
1042
|
disabled = ts.getData( $header[0], col, 'filter' ) === 'false' ||
|
1042
1043
|
ts.getData( $header[0], col, 'parser' ) === 'false';
|
1043
1044
|
|
1044
|
-
if (
|
1045
|
+
if ( makeSelect ) {
|
1045
1046
|
buildFilter = $( '<select>' ).appendTo( c.$filters.eq( column ) );
|
1046
1047
|
} else {
|
1047
1048
|
ffxn = ts.getColumnData( table, wo.filter_formatter, column );
|
@@ -1143,10 +1144,10 @@
|
|
1143
1144
|
},
|
1144
1145
|
searching: function( table, filter, skipFirst ) {
|
1145
1146
|
var wo = table.config.widgetOptions;
|
1146
|
-
clearTimeout( wo.
|
1147
|
+
clearTimeout( wo.filter_searchTimer );
|
1147
1148
|
if ( typeof filter === 'undefined' || filter === true ) {
|
1148
1149
|
// delay filtering
|
1149
|
-
wo.
|
1150
|
+
wo.filter_searchTimer = setTimeout( function() {
|
1150
1151
|
tsf.checkFilters( table, filter, skipFirst );
|
1151
1152
|
}, wo.filter_liveSearch ? wo.filter_searchDelay : 10 );
|
1152
1153
|
} else {
|
@@ -1204,7 +1205,7 @@
|
|
1204
1205
|
return false;
|
1205
1206
|
}
|
1206
1207
|
},
|
1207
|
-
hideFilters: function(
|
1208
|
+
hideFilters: function( c ) {
|
1208
1209
|
var timer;
|
1209
1210
|
c.$table
|
1210
1211
|
.find( '.' + tscss.filterRow )
|
@@ -1281,7 +1282,7 @@
|
|
1281
1282
|
targets = wo.filter_initialized || !$input.filter( wo.filter_anyColumnSelector ).length,
|
1282
1283
|
columns = [],
|
1283
1284
|
val = $.trim( tsf.getLatestSearch( $input ).attr( 'data-column' ) || '' );
|
1284
|
-
if (
|
1285
|
+
if ( /^[0-9]+$/.test(val)) {
|
1285
1286
|
return parseInt( val, 10 );
|
1286
1287
|
}
|
1287
1288
|
// process column range
|
@@ -1495,7 +1496,7 @@
|
|
1495
1496
|
!table.config.widgetOptions.filter_initialized ) {
|
1496
1497
|
return;
|
1497
1498
|
}
|
1498
|
-
var len, norm_rows, rowData, $rows, rowIndex, tbodyIndex, $tbody, columnIndex,
|
1499
|
+
var len, norm_rows, rowData, $rows, $row, rowIndex, tbodyIndex, $tbody, columnIndex,
|
1499
1500
|
isChild, childRow, lastSearch, showRow, time, val, indx,
|
1500
1501
|
notFiltered, searchFiltered, query, injected, res, id, txt,
|
1501
1502
|
storedFilters = $.extend( [], filters ),
|
@@ -1683,24 +1684,37 @@
|
|
1683
1684
|
'';
|
1684
1685
|
}
|
1685
1686
|
|
1686
|
-
showRow =
|
1687
|
+
showRow = false;
|
1688
|
+
val = tsf.processRow( c, data, vars );
|
1687
1689
|
childRow = rowData.$row.filter( ':gt( 0 )' );
|
1688
|
-
|
1689
1690
|
if ( wo.filter_childRows && childRow.length ) {
|
1691
|
+
if ( !wo.filter_childWithSibs ) {
|
1692
|
+
// hide all child rows
|
1693
|
+
childRow.addClass( wo.filter_filteredRow );
|
1694
|
+
}
|
1690
1695
|
if ( wo.filter_childByColumn ) {
|
1691
1696
|
// cycle through each child row
|
1692
1697
|
for ( indx = 0; indx < childRow.length; indx++ ) {
|
1693
1698
|
data.$row = childRow.eq( indx );
|
1694
1699
|
data.cacheArray = rowData.child[ indx ];
|
1695
1700
|
data.rawArray = data.cacheArray;
|
1701
|
+
val = tsf.processRow( c, data, vars );
|
1696
1702
|
// use OR comparison on child rows
|
1697
|
-
showRow = showRow ||
|
1703
|
+
showRow = showRow || val;
|
1704
|
+
if ( !wo.filter_childWithSibs && val ) {
|
1705
|
+
childRow.eq( indx ).removeClass( wo.filter_filteredRow );
|
1706
|
+
}
|
1698
1707
|
}
|
1699
1708
|
}
|
1700
|
-
|
1709
|
+
} else {
|
1710
|
+
showRow = val;
|
1701
1711
|
}
|
1702
|
-
|
1703
|
-
|
1712
|
+
$row = rowData.$row;
|
1713
|
+
// if only showing resulting child row, only include parent
|
1714
|
+
if ( !wo.filter_childWithSibs ) {
|
1715
|
+
$row = $row.eq( 0 );
|
1716
|
+
}
|
1717
|
+
$row
|
1704
1718
|
.toggleClass( wo.filter_filteredRow, !showRow )[0]
|
1705
1719
|
.display = showRow ? '' : 'none';
|
1706
1720
|
}
|
@@ -1728,14 +1742,12 @@
|
|
1728
1742
|
},
|
1729
1743
|
getOptionSource: function( table, column, onlyAvail ) {
|
1730
1744
|
table = $( table )[0];
|
1731
|
-
var
|
1732
|
-
c = table.config,
|
1745
|
+
var c = table.config,
|
1733
1746
|
wo = c.widgetOptions,
|
1734
|
-
parsed = [],
|
1735
1747
|
arry = false,
|
1736
1748
|
source = wo.filter_selectSource,
|
1737
1749
|
last = c.$table.data( 'lastSearch' ) || [],
|
1738
|
-
fxn =
|
1750
|
+
fxn = typeof source === 'function' ? true : ts.getColumnData( table, source, column );
|
1739
1751
|
|
1740
1752
|
if ( onlyAvail && last[column] !== '' ) {
|
1741
1753
|
onlyAvail = false;
|
@@ -1754,11 +1766,25 @@
|
|
1754
1766
|
// custom select source function for a SPECIFIC COLUMN
|
1755
1767
|
arry = fxn( table, column, onlyAvail );
|
1756
1768
|
}
|
1769
|
+
|
1757
1770
|
if ( arry === false ) {
|
1758
1771
|
// fall back to original method
|
1759
1772
|
arry = tsf.getOptions( table, column, onlyAvail );
|
1760
1773
|
}
|
1761
1774
|
|
1775
|
+
return tsf.processOptions( table, column, arry );
|
1776
|
+
|
1777
|
+
},
|
1778
|
+
processOptions: function( table, column, arry ) {
|
1779
|
+
if ( !$.isArray( arry ) ) {
|
1780
|
+
return false;
|
1781
|
+
}
|
1782
|
+
table = $( table )[0];
|
1783
|
+
var cts, txt, indx, len,
|
1784
|
+
c = table.config,
|
1785
|
+
validColumn = typeof column !== 'undefined' && column !== null && column >= 0 && column < c.columns,
|
1786
|
+
parsed = [];
|
1787
|
+
|
1762
1788
|
// get unique elements and sort the list
|
1763
1789
|
// if $.tablesorter.sortText exists ( not in the original tablesorter ),
|
1764
1790
|
// then natural sort the list otherwise use a basic sort
|
@@ -1766,7 +1792,7 @@
|
|
1766
1792
|
return $.inArray( value, arry ) === indx;
|
1767
1793
|
});
|
1768
1794
|
|
1769
|
-
if ( c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
1795
|
+
if ( validColumn && c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
1770
1796
|
// unsorted select options
|
1771
1797
|
return arry;
|
1772
1798
|
} else {
|
@@ -1779,7 +1805,8 @@
|
|
1779
1805
|
parsed.push({
|
1780
1806
|
t : txt,
|
1781
1807
|
// check parser length - fixes #934
|
1782
|
-
p :
|
1808
|
+
p : validColumn && c.parsers && c.parsers.length &&
|
1809
|
+
c.parsers[ column ].format( txt, table, [], column ) || txt
|
1783
1810
|
});
|
1784
1811
|
}
|
1785
1812
|
|
@@ -1789,10 +1816,10 @@
|
|
1789
1816
|
// sortNatural breaks if you don't pass it strings
|
1790
1817
|
var x = a.p.toString(),
|
1791
1818
|
y = b.p.toString();
|
1792
|
-
if (
|
1819
|
+
if ( validColumn && typeof cts === 'function' ) {
|
1793
1820
|
// custom OVERALL text sorter
|
1794
1821
|
return cts( x, y, true, column, table );
|
1795
|
-
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
1822
|
+
} else if ( validColumn && typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
1796
1823
|
// custom text sorter for a SPECIFIC COLUMN
|
1797
1824
|
return cts[column]( x, y, true, column, table );
|
1798
1825
|
} else if ( ts.sortNatural ) {
|
@@ -1850,6 +1877,7 @@
|
|
1850
1877
|
if ( !table.config.cache || $.isEmptyObject( table.config.cache ) ) {
|
1851
1878
|
return;
|
1852
1879
|
}
|
1880
|
+
|
1853
1881
|
var indx, val, txt, t, $filters, $filter,
|
1854
1882
|
c = table.config,
|
1855
1883
|
wo = c.widgetOptions,
|
@@ -1865,6 +1893,7 @@
|
|
1865
1893
|
.find( 'thead' )
|
1866
1894
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
1867
1895
|
.val();
|
1896
|
+
|
1868
1897
|
// nothing included in arry ( external source ), so get the options from
|
1869
1898
|
// filter_selectSource or column data
|
1870
1899
|
if ( typeof arry === 'undefined' || arry === '' ) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Widget: filter - updated 9/
|
1
|
+
/*! Widget: filter - updated 9/23/2015 (v2.23.4) *//*
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* by Rob Garrison
|
4
4
|
*/
|
@@ -21,6 +21,7 @@
|
|
21
21
|
options : {
|
22
22
|
filter_childRows : false, // if true, filter includes child row content in the search
|
23
23
|
filter_childByColumn : false, // ( filter_childRows must be true ) if true = search child rows by column; false = search all child row text grouped
|
24
|
+
filter_childWithSibs : true, // if true, include matching child row siblings
|
24
25
|
filter_columnFilters : true, // if true, a filter will be added to the top of each table column
|
25
26
|
filter_columnAnyMatch: true, // if true, allows using '#:{query}' in AnyMatch searches ( column:query )
|
26
27
|
filter_cellFilter : '', // css class name added to the filter cell ( string or array )
|
@@ -357,7 +358,7 @@
|
|
357
358
|
c.$table.addClass( 'hasFilters' );
|
358
359
|
|
359
360
|
// define timers so using clearTimeout won't cause an undefined error
|
360
|
-
wo.
|
361
|
+
wo.filter_searchTimer = null;
|
361
362
|
wo.filter_initTimer = null;
|
362
363
|
wo.filter_formatterCount = 0;
|
363
364
|
wo.filter_formatterInit = [];
|
@@ -490,7 +491,7 @@
|
|
490
491
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
491
492
|
.append( options );
|
492
493
|
txt = wo.filter_selectSource;
|
493
|
-
fxn =
|
494
|
+
fxn = typeof txt === 'function' ? true : ts.getColumnData( table, txt, column );
|
494
495
|
if ( fxn ) {
|
495
496
|
// updating so the extra options are appended
|
496
497
|
tsf.buildSelect( c.table, column, '', true, $header.hasClass( wo.filter_onlyAvail ) );
|
@@ -509,7 +510,7 @@
|
|
509
510
|
}
|
510
511
|
|
511
512
|
if ( wo.filter_hideFilters ) {
|
512
|
-
tsf.hideFilters(
|
513
|
+
tsf.hideFilters( c );
|
513
514
|
}
|
514
515
|
|
515
516
|
// show processing icon
|
@@ -636,7 +637,7 @@
|
|
636
637
|
return parsed ? c.parsers[column].format( filter, c.table, [], column ) : filter;
|
637
638
|
},
|
638
639
|
buildRow: function( table, c, wo ) {
|
639
|
-
var col, column, $header,
|
640
|
+
var col, column, $header, makeSelect, disabled, name, ffxn, tmp,
|
640
641
|
// c.columns defined in computeThIndexes()
|
641
642
|
cellFilter = wo.filter_cellFilter,
|
642
643
|
columns = c.columns,
|
@@ -660,14 +661,14 @@
|
|
660
661
|
// assuming last cell of a column is the main column
|
661
662
|
$header = c.$headerIndexed[ column ];
|
662
663
|
ffxn = ts.getColumnData( table, wo.filter_functions, column );
|
663
|
-
|
664
|
+
makeSelect = ( wo.filter_functions && ffxn && typeof ffxn !== 'function' ) ||
|
664
665
|
$header.hasClass( 'filter-select' );
|
665
666
|
// get data from jQuery data, metadata, headers option or header class name
|
666
667
|
col = ts.getColumnData( table, c.headers, column );
|
667
668
|
disabled = ts.getData( $header[0], col, 'filter' ) === 'false' ||
|
668
669
|
ts.getData( $header[0], col, 'parser' ) === 'false';
|
669
670
|
|
670
|
-
if (
|
671
|
+
if ( makeSelect ) {
|
671
672
|
buildFilter = $( '<select>' ).appendTo( c.$filters.eq( column ) );
|
672
673
|
} else {
|
673
674
|
ffxn = ts.getColumnData( table, wo.filter_formatter, column );
|
@@ -769,10 +770,10 @@
|
|
769
770
|
},
|
770
771
|
searching: function( table, filter, skipFirst ) {
|
771
772
|
var wo = table.config.widgetOptions;
|
772
|
-
clearTimeout( wo.
|
773
|
+
clearTimeout( wo.filter_searchTimer );
|
773
774
|
if ( typeof filter === 'undefined' || filter === true ) {
|
774
775
|
// delay filtering
|
775
|
-
wo.
|
776
|
+
wo.filter_searchTimer = setTimeout( function() {
|
776
777
|
tsf.checkFilters( table, filter, skipFirst );
|
777
778
|
}, wo.filter_liveSearch ? wo.filter_searchDelay : 10 );
|
778
779
|
} else {
|
@@ -830,7 +831,7 @@
|
|
830
831
|
return false;
|
831
832
|
}
|
832
833
|
},
|
833
|
-
hideFilters: function(
|
834
|
+
hideFilters: function( c ) {
|
834
835
|
var timer;
|
835
836
|
c.$table
|
836
837
|
.find( '.' + tscss.filterRow )
|
@@ -907,7 +908,7 @@
|
|
907
908
|
targets = wo.filter_initialized || !$input.filter( wo.filter_anyColumnSelector ).length,
|
908
909
|
columns = [],
|
909
910
|
val = $.trim( tsf.getLatestSearch( $input ).attr( 'data-column' ) || '' );
|
910
|
-
if (
|
911
|
+
if ( /^[0-9]+$/.test(val)) {
|
911
912
|
return parseInt( val, 10 );
|
912
913
|
}
|
913
914
|
// process column range
|
@@ -1121,7 +1122,7 @@
|
|
1121
1122
|
!table.config.widgetOptions.filter_initialized ) {
|
1122
1123
|
return;
|
1123
1124
|
}
|
1124
|
-
var len, norm_rows, rowData, $rows, rowIndex, tbodyIndex, $tbody, columnIndex,
|
1125
|
+
var len, norm_rows, rowData, $rows, $row, rowIndex, tbodyIndex, $tbody, columnIndex,
|
1125
1126
|
isChild, childRow, lastSearch, showRow, time, val, indx,
|
1126
1127
|
notFiltered, searchFiltered, query, injected, res, id, txt,
|
1127
1128
|
storedFilters = $.extend( [], filters ),
|
@@ -1309,24 +1310,37 @@
|
|
1309
1310
|
'';
|
1310
1311
|
}
|
1311
1312
|
|
1312
|
-
showRow =
|
1313
|
+
showRow = false;
|
1314
|
+
val = tsf.processRow( c, data, vars );
|
1313
1315
|
childRow = rowData.$row.filter( ':gt( 0 )' );
|
1314
|
-
|
1315
1316
|
if ( wo.filter_childRows && childRow.length ) {
|
1317
|
+
if ( !wo.filter_childWithSibs ) {
|
1318
|
+
// hide all child rows
|
1319
|
+
childRow.addClass( wo.filter_filteredRow );
|
1320
|
+
}
|
1316
1321
|
if ( wo.filter_childByColumn ) {
|
1317
1322
|
// cycle through each child row
|
1318
1323
|
for ( indx = 0; indx < childRow.length; indx++ ) {
|
1319
1324
|
data.$row = childRow.eq( indx );
|
1320
1325
|
data.cacheArray = rowData.child[ indx ];
|
1321
1326
|
data.rawArray = data.cacheArray;
|
1327
|
+
val = tsf.processRow( c, data, vars );
|
1322
1328
|
// use OR comparison on child rows
|
1323
|
-
showRow = showRow ||
|
1329
|
+
showRow = showRow || val;
|
1330
|
+
if ( !wo.filter_childWithSibs && val ) {
|
1331
|
+
childRow.eq( indx ).removeClass( wo.filter_filteredRow );
|
1332
|
+
}
|
1324
1333
|
}
|
1325
1334
|
}
|
1326
|
-
|
1335
|
+
} else {
|
1336
|
+
showRow = val;
|
1327
1337
|
}
|
1328
|
-
|
1329
|
-
|
1338
|
+
$row = rowData.$row;
|
1339
|
+
// if only showing resulting child row, only include parent
|
1340
|
+
if ( !wo.filter_childWithSibs ) {
|
1341
|
+
$row = $row.eq( 0 );
|
1342
|
+
}
|
1343
|
+
$row
|
1330
1344
|
.toggleClass( wo.filter_filteredRow, !showRow )[0]
|
1331
1345
|
.display = showRow ? '' : 'none';
|
1332
1346
|
}
|
@@ -1354,14 +1368,12 @@
|
|
1354
1368
|
},
|
1355
1369
|
getOptionSource: function( table, column, onlyAvail ) {
|
1356
1370
|
table = $( table )[0];
|
1357
|
-
var
|
1358
|
-
c = table.config,
|
1371
|
+
var c = table.config,
|
1359
1372
|
wo = c.widgetOptions,
|
1360
|
-
parsed = [],
|
1361
1373
|
arry = false,
|
1362
1374
|
source = wo.filter_selectSource,
|
1363
1375
|
last = c.$table.data( 'lastSearch' ) || [],
|
1364
|
-
fxn =
|
1376
|
+
fxn = typeof source === 'function' ? true : ts.getColumnData( table, source, column );
|
1365
1377
|
|
1366
1378
|
if ( onlyAvail && last[column] !== '' ) {
|
1367
1379
|
onlyAvail = false;
|
@@ -1380,11 +1392,25 @@
|
|
1380
1392
|
// custom select source function for a SPECIFIC COLUMN
|
1381
1393
|
arry = fxn( table, column, onlyAvail );
|
1382
1394
|
}
|
1395
|
+
|
1383
1396
|
if ( arry === false ) {
|
1384
1397
|
// fall back to original method
|
1385
1398
|
arry = tsf.getOptions( table, column, onlyAvail );
|
1386
1399
|
}
|
1387
1400
|
|
1401
|
+
return tsf.processOptions( table, column, arry );
|
1402
|
+
|
1403
|
+
},
|
1404
|
+
processOptions: function( table, column, arry ) {
|
1405
|
+
if ( !$.isArray( arry ) ) {
|
1406
|
+
return false;
|
1407
|
+
}
|
1408
|
+
table = $( table )[0];
|
1409
|
+
var cts, txt, indx, len,
|
1410
|
+
c = table.config,
|
1411
|
+
validColumn = typeof column !== 'undefined' && column !== null && column >= 0 && column < c.columns,
|
1412
|
+
parsed = [];
|
1413
|
+
|
1388
1414
|
// get unique elements and sort the list
|
1389
1415
|
// if $.tablesorter.sortText exists ( not in the original tablesorter ),
|
1390
1416
|
// then natural sort the list otherwise use a basic sort
|
@@ -1392,7 +1418,7 @@
|
|
1392
1418
|
return $.inArray( value, arry ) === indx;
|
1393
1419
|
});
|
1394
1420
|
|
1395
|
-
if ( c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
1421
|
+
if ( validColumn && c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
|
1396
1422
|
// unsorted select options
|
1397
1423
|
return arry;
|
1398
1424
|
} else {
|
@@ -1405,7 +1431,8 @@
|
|
1405
1431
|
parsed.push({
|
1406
1432
|
t : txt,
|
1407
1433
|
// check parser length - fixes #934
|
1408
|
-
p :
|
1434
|
+
p : validColumn && c.parsers && c.parsers.length &&
|
1435
|
+
c.parsers[ column ].format( txt, table, [], column ) || txt
|
1409
1436
|
});
|
1410
1437
|
}
|
1411
1438
|
|
@@ -1415,10 +1442,10 @@
|
|
1415
1442
|
// sortNatural breaks if you don't pass it strings
|
1416
1443
|
var x = a.p.toString(),
|
1417
1444
|
y = b.p.toString();
|
1418
|
-
if (
|
1445
|
+
if ( validColumn && typeof cts === 'function' ) {
|
1419
1446
|
// custom OVERALL text sorter
|
1420
1447
|
return cts( x, y, true, column, table );
|
1421
|
-
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
1448
|
+
} else if ( validColumn && typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
1422
1449
|
// custom text sorter for a SPECIFIC COLUMN
|
1423
1450
|
return cts[column]( x, y, true, column, table );
|
1424
1451
|
} else if ( ts.sortNatural ) {
|
@@ -1476,6 +1503,7 @@
|
|
1476
1503
|
if ( !table.config.cache || $.isEmptyObject( table.config.cache ) ) {
|
1477
1504
|
return;
|
1478
1505
|
}
|
1506
|
+
|
1479
1507
|
var indx, val, txt, t, $filters, $filter,
|
1480
1508
|
c = table.config,
|
1481
1509
|
wo = c.widgetOptions,
|
@@ -1491,6 +1519,7 @@
|
|
1491
1519
|
.find( 'thead' )
|
1492
1520
|
.find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
|
1493
1521
|
.val();
|
1522
|
+
|
1494
1523
|
// nothing included in arry ( external source ), so get the options from
|
1495
1524
|
// filter_selectSource or column data
|
1496
1525
|
if ( typeof arry === 'undefined' || arry === '' ) {
|
@@ -465,6 +465,10 @@
|
|
465
465
|
}, 40 );
|
466
466
|
});
|
467
467
|
wo.math_isUpdating = false;
|
468
|
+
// math widget initialized after table - see #946
|
469
|
+
if ( table.hasInitialized ) {
|
470
|
+
math.recalculate( c, wo, true );
|
471
|
+
}
|
468
472
|
},
|
469
473
|
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
470
474
|
// this function only applies to tablesorter v2.4+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-tablesorter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jun Lin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|