jquery-tablesorter 1.21.4 → 1.22.0
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 +2 -2
- data/vendor/assets/images/jquery-tablesorter/bootstrap-black-unsorted.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/metro-black-asc.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/metro-black-desc.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/metro-white-asc.png +0 -0
- data/vendor/assets/images/jquery-tablesorter/metro-white-desc.png +0 -0
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +63 -43
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +33 -21
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +30 -22
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +62 -24
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-currentSort.js +60 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +13 -10
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-mark.js +135 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +24 -15
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +4 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +10 -5
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js +4 -4
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.bootstrap_2.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.materialize.css +176 -0
- metadata +5 -2
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 07-
|
7
|
+
/*! tablesorter (FORK) - updated 07-31-2016 (v2.27.1)*/
|
8
8
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9
9
|
(function(factory) {
|
10
10
|
if (typeof define === 'function' && define.amd) {
|
@@ -14,7 +14,7 @@
|
|
14
14
|
} else {
|
15
15
|
factory(jQuery);
|
16
16
|
}
|
17
|
-
}(function(
|
17
|
+
}(function(jQuery) {
|
18
18
|
|
19
19
|
/*! Widget: storage - updated 3/1/2016 (v2.25.5) */
|
20
20
|
/*global JSON:false */
|
@@ -107,7 +107,7 @@
|
|
107
107
|
|
108
108
|
})(jQuery, window, document);
|
109
109
|
|
110
|
-
/*! Widget: uitheme - updated 7/
|
110
|
+
/*! Widget: uitheme - updated 7/31/2016 (v2.27.0) */
|
111
111
|
;(function ($) {
|
112
112
|
'use strict';
|
113
113
|
var ts = $.tablesorter || {};
|
@@ -146,9 +146,9 @@
|
|
146
146
|
hover : 'ui-state-hover', // hover class
|
147
147
|
// icon class names
|
148
148
|
icons : 'ui-icon', // icon class added to the <i> in the header
|
149
|
-
iconSortNone : 'ui-icon-carat-2-n-s', // class name added to icon when column is not sorted
|
150
|
-
iconSortAsc : 'ui-icon-carat-1-n', // class name added to icon when column has ascending sort
|
151
|
-
iconSortDesc : 'ui-icon-carat-1-s', // class name added to icon when column has descending sort
|
149
|
+
iconSortNone : 'ui-icon-carat-2-n-s ui-icon-caret-2-n-s', // class name added to icon when column is not sorted
|
150
|
+
iconSortAsc : 'ui-icon-carat-1-n ui-icon-caret-1-n', // class name added to icon when column has ascending sort
|
151
|
+
iconSortDesc : 'ui-icon-carat-1-s ui-icon-caret-1-s', // class name added to icon when column has descending sort
|
152
152
|
filterRow : '',
|
153
153
|
footerRow : '',
|
154
154
|
footerCells : '',
|
@@ -382,7 +382,7 @@
|
|
382
382
|
|
383
383
|
})(jQuery);
|
384
384
|
|
385
|
-
/*! Widget: filter - updated 7/
|
385
|
+
/*! Widget: filter - updated 7/31/2016 (v2.27.0) *//*
|
386
386
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
387
387
|
* by Rob Garrison
|
388
388
|
*/
|
@@ -478,7 +478,7 @@
|
|
478
478
|
|
479
479
|
// regex used in filter 'check' functions - not for general use and not documented
|
480
480
|
regex: {
|
481
|
-
regex : /^\/((?:\\\/|[^\/])+)\/([
|
481
|
+
regex : /^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/, // regex to test for regex
|
482
482
|
child : /tablesorter-childRow/, // child row class name; this gets updated in the script
|
483
483
|
filtered : /filtered/, // filtered (hidden) row class name; updated in the script
|
484
484
|
type : /undefined|number/, // check type
|
@@ -821,6 +821,8 @@
|
|
821
821
|
// force a new search since content has changed
|
822
822
|
c.lastCombinedFilter = null;
|
823
823
|
c.lastSearch = [];
|
824
|
+
// update filterFormatters after update - Fixes #1237
|
825
|
+
c.$table.triggerHandler( 'filterFomatterUpdate' );
|
824
826
|
}
|
825
827
|
// pass true ( skipFirst ) to prevent the tablesorter.setFilters function from skipping the first
|
826
828
|
// input ensures all inputs are updated when a search is triggered on the table
|
@@ -985,8 +987,10 @@
|
|
985
987
|
count = 0,
|
986
988
|
completed = function() {
|
987
989
|
wo.filter_initialized = true;
|
990
|
+
// update lastSearch - it gets cleared often
|
991
|
+
c.lastSearch = c.$table.data( 'lastSearch' );
|
988
992
|
c.$table.triggerHandler( 'filterInit', c );
|
989
|
-
tsf.findRows( c.table, c
|
993
|
+
tsf.findRows( c.table, c.lastSearch || [] );
|
990
994
|
};
|
991
995
|
if ( $.isEmptyObject( wo.filter_formatter ) ) {
|
992
996
|
completed();
|
@@ -1471,6 +1475,7 @@
|
|
1471
1475
|
fxn, ffxn, txt,
|
1472
1476
|
wo = c.widgetOptions,
|
1473
1477
|
showRow = true,
|
1478
|
+
hasAnyMatchInput = wo.filter_$anyMatch && wo.filter_$anyMatch.length,
|
1474
1479
|
|
1475
1480
|
// if wo.filter_$anyMatch data-column attribute is changed dynamically
|
1476
1481
|
// we don't want to do an "anyMatch" search on one column using data
|
@@ -1480,11 +1485,11 @@
|
|
1480
1485
|
tsf.multipleColumns( c, wo.filter_$anyMatch ) :
|
1481
1486
|
[];
|
1482
1487
|
data.$cells = data.$row.children();
|
1483
|
-
if ( data.anyMatchFlag && columnIndex.length > 1 || data.anyMatchFilter ) {
|
1488
|
+
if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
|
1484
1489
|
data.anyMatch = true;
|
1485
1490
|
data.isMatch = true;
|
1486
1491
|
data.rowArray = data.$cells.map( function( i ) {
|
1487
|
-
if ( $.inArray( i, columnIndex ) > -1 || data.anyMatchFilter ) {
|
1492
|
+
if ( $.inArray( i, columnIndex ) > -1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
|
1488
1493
|
if ( data.parsed[ i ] ) {
|
1489
1494
|
txt = data.cacheArray[ i ];
|
1490
1495
|
} else {
|
@@ -1774,6 +1779,7 @@
|
|
1774
1779
|
}
|
1775
1780
|
|
1776
1781
|
data.$row = $rows.eq( rowIndex );
|
1782
|
+
data.rowIndex = rowIndex;
|
1777
1783
|
data.cacheArray = norm_rows[ rowIndex ];
|
1778
1784
|
rowData = data.cacheArray[ c.columns ];
|
1779
1785
|
data.rawArray = rowData.raw;
|
@@ -2129,7 +2135,7 @@
|
|
2129
2135
|
|
2130
2136
|
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
2131
2137
|
var i, $filters, $column, cols,
|
2132
|
-
filters =
|
2138
|
+
filters = [],
|
2133
2139
|
c = table ? $( table )[0].config : '',
|
2134
2140
|
wo = c ? c.widgetOptions : '';
|
2135
2141
|
if ( ( getRaw !== true && wo && !wo.filter_columnFilters ) ||
|
@@ -2195,9 +2201,6 @@
|
|
2195
2201
|
}
|
2196
2202
|
}
|
2197
2203
|
}
|
2198
|
-
if ( filters.length === 0 ) {
|
2199
|
-
filters = false;
|
2200
|
-
}
|
2201
2204
|
return filters;
|
2202
2205
|
};
|
2203
2206
|
|
@@ -2215,12 +2218,12 @@
|
|
2215
2218
|
tsf.searching( c.table, filter, skipFirst );
|
2216
2219
|
c.$table.triggerHandler( 'filterFomatterUpdate' );
|
2217
2220
|
}
|
2218
|
-
return
|
2221
|
+
return valid.length !== 0;
|
2219
2222
|
};
|
2220
2223
|
|
2221
2224
|
})( jQuery );
|
2222
2225
|
|
2223
|
-
/*! Widget: stickyHeaders - updated
|
2226
|
+
/*! Widget: stickyHeaders - updated 7/31/2016 (v2.27.0) *//*
|
2224
2227
|
* Requires tablesorter v2.8+ and jQuery 1.4.3+
|
2225
2228
|
* by Rob Garrison
|
2226
2229
|
*/
|
@@ -2283,10 +2286,11 @@
|
|
2283
2286
|
// **************************
|
2284
2287
|
ts.addWidget({
|
2285
2288
|
id: 'stickyHeaders',
|
2286
|
-
priority:
|
2289
|
+
priority: 55, // sticky widget must be initialized after the filter widget!
|
2287
2290
|
options: {
|
2288
2291
|
stickyHeaders : '', // extra class name added to the sticky header row
|
2289
|
-
|
2292
|
+
stickyHeaders_appendTo : null, // jQuery selector or object to phycially attach the sticky headers
|
2293
|
+
stickyHeaders_attachTo : null, // jQuery selector or object to attach scroll listener to (overridden by xScroll & yScroll settings)
|
2290
2294
|
stickyHeaders_xScroll : null, // jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window)
|
2291
2295
|
stickyHeaders_yScroll : null, // jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window)
|
2292
2296
|
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
@@ -2437,8 +2441,12 @@
|
|
2437
2441
|
|
2438
2442
|
ts.bindEvents(table, $stickyThead.children().children('.' + ts.css.header));
|
2439
2443
|
|
2440
|
-
|
2441
|
-
|
2444
|
+
if (wo.stickyHeaders_appendTo) {
|
2445
|
+
$(wo.stickyHeaders_appendTo).append( $stickyWrap );
|
2446
|
+
} else {
|
2447
|
+
// add stickyheaders AFTER the table. If the table is selected by ID, the original one (first) will be returned.
|
2448
|
+
$table.after( $stickyWrap );
|
2449
|
+
}
|
2442
2450
|
|
2443
2451
|
// onRenderHeader is defined, we need to do something about it (fixes #641)
|
2444
2452
|
if (c.onRenderHeader) {
|
@@ -2984,5 +2992,5 @@
|
|
2984
2992
|
|
2985
2993
|
})(jQuery);
|
2986
2994
|
|
2987
|
-
return
|
2995
|
+
return jQuery.tablesorter;
|
2988
2996
|
}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Widget: columnSelector (responsive table widget) - updated 7/
|
1
|
+
/* Widget: columnSelector (responsive table widget) - updated 7/31/2016 (v2.27.1) *//*
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* by Justin Hallett & Rob Garrison
|
4
4
|
*/
|
@@ -72,14 +72,14 @@
|
|
72
72
|
isArry = $.isArray(optState || optName),
|
73
73
|
wo = c.widgetOptions;
|
74
74
|
// see #798
|
75
|
-
if (typeof optName !== 'undefined' && colSel.$container.length) {
|
75
|
+
if (typeof optName !== 'undefined' && optName !== null && colSel.$container.length) {
|
76
76
|
// pass "selectors" to update the all of the container contents
|
77
77
|
if ( optName === 'selectors' ) {
|
78
78
|
colSel.$container.empty();
|
79
79
|
tsColSel.setupSelector(c, wo);
|
80
80
|
tsColSel.setupBreakpoints(c, wo);
|
81
81
|
// if optState is undefined, maintain the current "auto" state
|
82
|
-
if ( typeof optState === 'undefined' ) {
|
82
|
+
if ( typeof optState === 'undefined' && optState !== null ) {
|
83
83
|
optState = colSel.auto;
|
84
84
|
}
|
85
85
|
}
|
@@ -140,12 +140,13 @@
|
|
140
140
|
// include getData check (includes 'columnSelector-false' class, data attribute, etc)
|
141
141
|
if ( isNaN(priority) && priority.length > 0 || state === 'disable' ||
|
142
142
|
( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) {
|
143
|
+
colSel.states[colId] = null;
|
143
144
|
continue; // goto next
|
144
145
|
}
|
145
146
|
|
146
147
|
// set default state; storage takes priority
|
147
|
-
colSel.states[colId] = saved && typeof saved[colId] !== 'undefined' ?
|
148
|
-
saved[colId] : typeof wo.columnSelector_columns[colId] !== 'undefined' ?
|
148
|
+
colSel.states[colId] = saved && (typeof saved[colId] !== 'undefined' && saved[colId] !== null) ?
|
149
|
+
saved[colId] : (typeof wo.columnSelector_columns[colId] !== 'undefined' && wo.columnSelector_columns[colId] !== null) ?
|
149
150
|
wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false');
|
150
151
|
colSel.$column[colId] = $(this);
|
151
152
|
|
@@ -159,17 +160,44 @@
|
|
159
160
|
.attr('data-column', colId)
|
160
161
|
.toggleClass( wo.columnSelector_cssChecked, colSel.states[colId] )
|
161
162
|
.prop('checked', colSel.states[colId])
|
162
|
-
.on('change', function(){
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
163
|
+
.on('change', function() {
|
164
|
+
if (!colSel.isInitializing) {
|
165
|
+
// ensure states is accurate
|
166
|
+
var colId = $(this).attr('data-column');
|
167
|
+
if (tsColSel.checkChange(c, this.checked)) {
|
168
|
+
// if (wo.columnSelector_maxVisible)
|
169
|
+
c.selector.states[colId] = this.checked;
|
170
|
+
tsColSel.updateCols(c, wo);
|
171
|
+
} else {
|
172
|
+
this.checked = !this.checked;
|
173
|
+
return false;
|
174
|
+
}
|
175
|
+
}
|
167
176
|
}).change();
|
168
177
|
}
|
169
178
|
}
|
170
179
|
|
171
180
|
},
|
172
181
|
|
182
|
+
checkChange: function(c, checked) {
|
183
|
+
var wo = c.widgetOptions,
|
184
|
+
max = wo.columnSelector_maxVisible,
|
185
|
+
min = wo.columnSelector_minVisible,
|
186
|
+
states = c.selector.states,
|
187
|
+
indx = states.length,
|
188
|
+
count = 0;
|
189
|
+
while (indx-- >= 0) {
|
190
|
+
if (states[indx]) {
|
191
|
+
count++;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
if ((checked & max !== null && count >= max) ||
|
195
|
+
(!checked && min !== null && count <= min)) {
|
196
|
+
return false;
|
197
|
+
}
|
198
|
+
return true;
|
199
|
+
},
|
200
|
+
|
173
201
|
setupBreakpoints: function(c, wo) {
|
174
202
|
var colSel = c.selector;
|
175
203
|
|
@@ -388,7 +416,7 @@
|
|
388
416
|
} else {
|
389
417
|
$cell.addClass( filtered );
|
390
418
|
}
|
391
|
-
} else if ( typeof colSel.states[ col ] !== 'undefined' ) {
|
419
|
+
} else if ( typeof colSel.states[ col ] !== 'undefined' && colSel.states[ col ] !== null ) {
|
392
420
|
$cell.toggleClass( filtered, !colSel.states[ col ] );
|
393
421
|
}
|
394
422
|
}
|
@@ -423,13 +451,20 @@
|
|
423
451
|
.toggleClass( wo.columnSelector_cssChecked, isChecked )
|
424
452
|
.prop( 'checked', isChecked );
|
425
453
|
});
|
426
|
-
colSel.$popup = $popup.on('change', 'input', function(){
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
454
|
+
colSel.$popup = $popup.on('change', 'input', function() {
|
455
|
+
if (!colSel.isInitializing) {
|
456
|
+
if (tsColSel.checkChange(c, this.checked)) {
|
457
|
+
// data input
|
458
|
+
indx = $(this).toggleClass( wo.columnSelector_cssChecked, this.checked ).attr('data-column');
|
459
|
+
// update original popup
|
460
|
+
colSel.$container.find('input[data-column="' + indx + '"]')
|
461
|
+
.prop('checked', this.checked)
|
462
|
+
.trigger('change');
|
463
|
+
} else {
|
464
|
+
this.checked = !this.checked;
|
465
|
+
return false;
|
466
|
+
}
|
467
|
+
}
|
433
468
|
});
|
434
469
|
}
|
435
470
|
}
|
@@ -461,17 +496,21 @@
|
|
461
496
|
// container layout
|
462
497
|
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
|
463
498
|
// data attribute containing column name to use in the selector container
|
464
|
-
columnSelector_name
|
499
|
+
columnSelector_name : 'data-selector-name',
|
465
500
|
|
466
501
|
/* Responsive Media Query settings */
|
467
502
|
// enable/disable mediaquery breakpoints
|
468
|
-
columnSelector_mediaquery: true,
|
503
|
+
columnSelector_mediaquery : true,
|
469
504
|
// toggle checkbox name
|
470
|
-
columnSelector_mediaqueryName: 'Auto: ',
|
505
|
+
columnSelector_mediaqueryName : 'Auto: ',
|
471
506
|
// breakpoints checkbox initial setting
|
472
|
-
columnSelector_mediaqueryState: true,
|
507
|
+
columnSelector_mediaqueryState : true,
|
473
508
|
// hide columnSelector false columns while in auto mode
|
474
|
-
columnSelector_mediaqueryHidden: false,
|
509
|
+
columnSelector_mediaqueryHidden : false,
|
510
|
+
// set the maximum and/or minimum number of visible columns
|
511
|
+
columnSelector_maxVisible : null,
|
512
|
+
columnSelector_minVisible : null,
|
513
|
+
|
475
514
|
// responsive table hides columns with priority 1-6 at these breakpoints
|
476
515
|
// see http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/#Applyingapresetbreakpoint
|
477
516
|
// *** set to false to disable ***
|
@@ -488,7 +527,6 @@
|
|
488
527
|
columnSelector_cssChecked : 'checked',
|
489
528
|
// event triggered when columnSelector completes
|
490
529
|
columnSelector_updated : 'columnUpdate'
|
491
|
-
|
492
530
|
},
|
493
531
|
init: function(table, thisWidget, c, wo) {
|
494
532
|
tsColSel.init(table, c, wo);
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/*! Widget: currentSort - 7/31/2016 (v2.27.0) *//*
|
2
|
+
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
|
+
* by Rob Garrison
|
4
|
+
*/
|
5
|
+
;( function( $ ) {
|
6
|
+
'use strict';
|
7
|
+
var ts = $.tablesorter;
|
8
|
+
|
9
|
+
ts.currentSortLanguage = {
|
10
|
+
0: 'asc',
|
11
|
+
1: 'desc',
|
12
|
+
2: 'unsorted'
|
13
|
+
};
|
14
|
+
|
15
|
+
ts.currentSort = {
|
16
|
+
init : function( c ) {
|
17
|
+
c.$table.on( 'sortEnd.tscurrentSort', function() {
|
18
|
+
ts.currentSort.update( this.config );
|
19
|
+
});
|
20
|
+
},
|
21
|
+
update: function( c ) {
|
22
|
+
if ( c ) {
|
23
|
+
var indx,
|
24
|
+
wo = c.widgetOptions,
|
25
|
+
lang = ts.currentSortLanguage,
|
26
|
+
unsort = lang[ 2 ],
|
27
|
+
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
|
28
|
+
// order = new Array(c.columns).fill(unsort),
|
29
|
+
// the above ES6 will not work in all browsers, so
|
30
|
+
// we're stuck with this messy code to fill the array:
|
31
|
+
order = Array
|
32
|
+
.apply( null, Array( c.columns ) )
|
33
|
+
.map( String.prototype.valueOf, unsort ),
|
34
|
+
sortList = c.sortList,
|
35
|
+
len = sortList.length;
|
36
|
+
for ( indx = 0; indx < len; indx++ ) {
|
37
|
+
order[ sortList[ indx ][ 0 ] ] = lang[ sortList[ indx ][ 1 ] ];
|
38
|
+
}
|
39
|
+
c.currentSort = order;
|
40
|
+
if ( typeof wo.currentSort_callback === 'function' ) {
|
41
|
+
wo.currentSort_callback(c, order);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
ts.addWidget({
|
48
|
+
id: 'currentSort',
|
49
|
+
options: {
|
50
|
+
currentSort_callback : null
|
51
|
+
},
|
52
|
+
init : function( table, thisWidget, c, wo ) {
|
53
|
+
ts.currentSort.init( c, wo );
|
54
|
+
},
|
55
|
+
remove : function( table, c ) {
|
56
|
+
c.$table.off( 'sortEnd.tscurrentSort' );
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
})( jQuery );
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Widget: filter - updated 7/
|
1
|
+
/*! Widget: filter - updated 7/31/2016 (v2.27.0) *//*
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* by Rob Garrison
|
4
4
|
*/
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
// regex used in filter 'check' functions - not for general use and not documented
|
96
96
|
regex: {
|
97
|
-
regex : /^\/((?:\\\/|[^\/])+)\/([
|
97
|
+
regex : /^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/, // regex to test for regex
|
98
98
|
child : /tablesorter-childRow/, // child row class name; this gets updated in the script
|
99
99
|
filtered : /filtered/, // filtered (hidden) row class name; updated in the script
|
100
100
|
type : /undefined|number/, // check type
|
@@ -437,6 +437,8 @@
|
|
437
437
|
// force a new search since content has changed
|
438
438
|
c.lastCombinedFilter = null;
|
439
439
|
c.lastSearch = [];
|
440
|
+
// update filterFormatters after update - Fixes #1237
|
441
|
+
c.$table.triggerHandler( 'filterFomatterUpdate' );
|
440
442
|
}
|
441
443
|
// pass true ( skipFirst ) to prevent the tablesorter.setFilters function from skipping the first
|
442
444
|
// input ensures all inputs are updated when a search is triggered on the table
|
@@ -601,8 +603,10 @@
|
|
601
603
|
count = 0,
|
602
604
|
completed = function() {
|
603
605
|
wo.filter_initialized = true;
|
606
|
+
// update lastSearch - it gets cleared often
|
607
|
+
c.lastSearch = c.$table.data( 'lastSearch' );
|
604
608
|
c.$table.triggerHandler( 'filterInit', c );
|
605
|
-
tsf.findRows( c.table, c
|
609
|
+
tsf.findRows( c.table, c.lastSearch || [] );
|
606
610
|
};
|
607
611
|
if ( $.isEmptyObject( wo.filter_formatter ) ) {
|
608
612
|
completed();
|
@@ -1087,6 +1091,7 @@
|
|
1087
1091
|
fxn, ffxn, txt,
|
1088
1092
|
wo = c.widgetOptions,
|
1089
1093
|
showRow = true,
|
1094
|
+
hasAnyMatchInput = wo.filter_$anyMatch && wo.filter_$anyMatch.length,
|
1090
1095
|
|
1091
1096
|
// if wo.filter_$anyMatch data-column attribute is changed dynamically
|
1092
1097
|
// we don't want to do an "anyMatch" search on one column using data
|
@@ -1096,11 +1101,11 @@
|
|
1096
1101
|
tsf.multipleColumns( c, wo.filter_$anyMatch ) :
|
1097
1102
|
[];
|
1098
1103
|
data.$cells = data.$row.children();
|
1099
|
-
if ( data.anyMatchFlag && columnIndex.length > 1 || data.anyMatchFilter ) {
|
1104
|
+
if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
|
1100
1105
|
data.anyMatch = true;
|
1101
1106
|
data.isMatch = true;
|
1102
1107
|
data.rowArray = data.$cells.map( function( i ) {
|
1103
|
-
if ( $.inArray( i, columnIndex ) > -1 || data.anyMatchFilter ) {
|
1108
|
+
if ( $.inArray( i, columnIndex ) > -1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
|
1104
1109
|
if ( data.parsed[ i ] ) {
|
1105
1110
|
txt = data.cacheArray[ i ];
|
1106
1111
|
} else {
|
@@ -1390,6 +1395,7 @@
|
|
1390
1395
|
}
|
1391
1396
|
|
1392
1397
|
data.$row = $rows.eq( rowIndex );
|
1398
|
+
data.rowIndex = rowIndex;
|
1393
1399
|
data.cacheArray = norm_rows[ rowIndex ];
|
1394
1400
|
rowData = data.cacheArray[ c.columns ];
|
1395
1401
|
data.rawArray = rowData.raw;
|
@@ -1745,7 +1751,7 @@
|
|
1745
1751
|
|
1746
1752
|
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
1747
1753
|
var i, $filters, $column, cols,
|
1748
|
-
filters =
|
1754
|
+
filters = [],
|
1749
1755
|
c = table ? $( table )[0].config : '',
|
1750
1756
|
wo = c ? c.widgetOptions : '';
|
1751
1757
|
if ( ( getRaw !== true && wo && !wo.filter_columnFilters ) ||
|
@@ -1811,9 +1817,6 @@
|
|
1811
1817
|
}
|
1812
1818
|
}
|
1813
1819
|
}
|
1814
|
-
if ( filters.length === 0 ) {
|
1815
|
-
filters = false;
|
1816
|
-
}
|
1817
1820
|
return filters;
|
1818
1821
|
};
|
1819
1822
|
|
@@ -1831,7 +1834,7 @@
|
|
1831
1834
|
tsf.searching( c.table, filter, skipFirst );
|
1832
1835
|
c.$table.triggerHandler( 'filterFomatterUpdate' );
|
1833
1836
|
}
|
1834
|
-
return
|
1837
|
+
return valid.length !== 0;
|
1835
1838
|
};
|
1836
1839
|
|
1837
1840
|
})( jQuery );
|