jquery-tablesorter 1.20.1 → 1.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +39 -16
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +8 -4
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +31 -12
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +30 -11
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +6 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19368ab000f6255ad881bc8de033aeac5f2f28c1
|
4
|
+
data.tar.gz: 253d804a8e656d63c63f20580c71da20c223671f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 020827d35135c9b0e1f0650409a9afa3e19e6f7dc58ec76c7249a26df4c0e8f183a7fe8de80b5e8ddb9391c4e1a6a700059cdcf50a2a10af744683212dcfed9e
|
7
|
+
data.tar.gz: eb0f673d5955bc90fa4d7e83624cb3c326e85086c93711bda194ae6f4d9097b383f2bf2746e81e904a056c6a81d2a8dfdef267649ad455f2bb0739db4b4fbaaa
|
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.25.
|
7
|
+
Current tablesorter version: 2.25.2 (1/15/2016), [documentation]
|
8
8
|
|
9
9
|
Any issue associated with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Requirements
|
26
26
|
|
27
|
-
It should work with Rails 3.2 and higher (tested up to 4.2) as well as with ruby 1.9.3 - 2.
|
27
|
+
It should work with Rails 3.2 and higher (tested up to 4.2) as well as with ruby 1.9.3 - 2.3.x.
|
28
28
|
Each release is always tested with the latest version of both.
|
29
29
|
|
30
30
|
## Usage
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 01-
|
7
|
+
/*! tablesorter (FORK) - updated 01-15-2016 (v2.25.2)*/
|
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.25.
|
19
|
+
/*! TableSorter (FORK) v2.25.2 *//*
|
20
20
|
* Client-side table sorting with ease!
|
21
21
|
* @requires jQuery v1.2.6+
|
22
22
|
*
|
@@ -39,7 +39,7 @@
|
|
39
39
|
'use strict';
|
40
40
|
var ts = $.tablesorter = {
|
41
41
|
|
42
|
-
version : '2.25.
|
42
|
+
version : '2.25.2',
|
43
43
|
|
44
44
|
parsers : [],
|
45
45
|
widgets : [],
|
@@ -208,6 +208,10 @@
|
|
208
208
|
bottom : false
|
209
209
|
},
|
210
210
|
|
211
|
+
keyCodes : {
|
212
|
+
enter : 13
|
213
|
+
},
|
214
|
+
|
211
215
|
// placeholder date parser data (globalize)
|
212
216
|
dates : {},
|
213
217
|
|
@@ -476,7 +480,7 @@
|
|
476
480
|
// only recognize left clicks
|
477
481
|
if ( ( ( e.which || e.button ) !== 1 && !type.match( ' ' + c.pointerClick + ' | sort | keyup ' ) ) ||
|
478
482
|
// allow pressing enter
|
479
|
-
( type === ' keyup ' && e.which !==
|
483
|
+
( type === ' keyup ' && e.which !== ts.keyCodes.enter ) ||
|
480
484
|
// allow triggering a click event (e.which is undefined) & ignore physical clicks
|
481
485
|
( type.match( ' ' + c.pointerClick + ' ' ) && typeof e.which !== 'undefined' ) ) {
|
482
486
|
return;
|
@@ -1064,8 +1068,8 @@
|
|
1064
1068
|
// find the footer
|
1065
1069
|
$headers = c.$table
|
1066
1070
|
.find( 'tfoot tr' )
|
1067
|
-
.add( $( c.namespace + '_extra_headers' ).children( 'tr' ) )
|
1068
1071
|
.children( 'td, th' )
|
1072
|
+
.add( $( c.namespace + '_extra_headers' ) )
|
1069
1073
|
.removeClass( css.join( ' ' ) );
|
1070
1074
|
// remove all header information
|
1071
1075
|
c.$headers
|
@@ -3086,7 +3090,7 @@
|
|
3086
3090
|
|
3087
3091
|
})(jQuery);
|
3088
3092
|
|
3089
|
-
/*! Widget: filter - updated 1/
|
3093
|
+
/*! Widget: filter - updated 1/15/2016 (v2.25.2) *//*
|
3090
3094
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3091
3095
|
* by Rob Garrison
|
3092
3096
|
*/
|
@@ -3094,7 +3098,8 @@
|
|
3094
3098
|
'use strict';
|
3095
3099
|
var tsf, tsfRegex,
|
3096
3100
|
ts = $.tablesorter || {},
|
3097
|
-
tscss = ts.css
|
3101
|
+
tscss = ts.css,
|
3102
|
+
tskeyCodes = ts.keyCodes;
|
3098
3103
|
|
3099
3104
|
$.extend( tscss, {
|
3100
3105
|
filterRow : 'tablesorter-filter-row',
|
@@ -3103,6 +3108,14 @@
|
|
3103
3108
|
filterRowHide : 'hideme'
|
3104
3109
|
});
|
3105
3110
|
|
3111
|
+
$.extend( tskeyCodes, {
|
3112
|
+
backSpace : 8,
|
3113
|
+
escape : 27,
|
3114
|
+
space : 32,
|
3115
|
+
left : 37,
|
3116
|
+
down : 40
|
3117
|
+
});
|
3118
|
+
|
3106
3119
|
ts.addWidget({
|
3107
3120
|
id: 'filter',
|
3108
3121
|
priority: 50,
|
@@ -3127,6 +3140,7 @@
|
|
3127
3140
|
filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available ( visible ) options within the drop down
|
3128
3141
|
filter_placeholder : { search : '', select : '' }, // default placeholder text ( overridden by any header 'data-placeholder' setting )
|
3129
3142
|
filter_reset : null, // jQuery selector string of an element used to reset the filters
|
3143
|
+
filter_resetOnEsc : true, // Reset filter input when the user presses escape - normalized across browsers
|
3130
3144
|
filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
|
3131
3145
|
filter_searchDelay : 300, // typing delay in milliseconds before starting a search
|
3132
3146
|
filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
|
@@ -3835,18 +3849,25 @@
|
|
3835
3849
|
ts.setFilters( table, c.$table.data( 'lastSearch' ) || [], internal === false );
|
3836
3850
|
}
|
3837
3851
|
// unbind events
|
3838
|
-
tmp = ( 'keypress keyup search change '.split( ' ' ).join( namespace + ' ' ) );
|
3852
|
+
tmp = ( 'keypress keyup keydown search change input '.split( ' ' ).join( namespace + ' ' ) );
|
3839
3853
|
$el
|
3840
3854
|
// use data attribute instead of jQuery data since the head is cloned without including
|
3841
3855
|
// the data/binding
|
3842
3856
|
.attr( 'data-lastSearchTime', new Date().getTime() )
|
3843
3857
|
.unbind( tmp.replace( ts.regex.spaces, ' ' ) )
|
3844
|
-
|
3858
|
+
.bind( 'keydown' + namespace, function( event ) {
|
3859
|
+
if ( event.which === tskeyCodes.escape && !wo.filter_resetOnEsc ) {
|
3860
|
+
// prevent keypress event
|
3861
|
+
return false;
|
3862
|
+
}
|
3863
|
+
})
|
3845
3864
|
.bind( 'keyup' + namespace, function( event ) {
|
3865
|
+
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
3846
3866
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
3847
3867
|
// emulate what webkit does.... escape clears the filter
|
3848
|
-
if ( event.which ===
|
3849
|
-
|
3868
|
+
if ( event.which === tskeyCodes.escape ) {
|
3869
|
+
// make sure to restore the last value on escape
|
3870
|
+
this.value = wo.filter_resetOnEsc ? '' : c.lastSearch[column];
|
3850
3871
|
// live search
|
3851
3872
|
} else if ( wo.filter_liveSearch === false ) {
|
3852
3873
|
return;
|
@@ -3855,19 +3876,21 @@
|
|
3855
3876
|
// liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace
|
3856
3877
|
( typeof wo.filter_liveSearch === 'number' && this.value.length < wo.filter_liveSearch ) ||
|
3857
3878
|
// let return & backspace continue on, but ignore arrows & non-valid characters
|
3858
|
-
( event.which !==
|
3859
|
-
( event.which <
|
3879
|
+
( event.which !== tskeyCodes.enter && event.which !== tskeyCodes.backSpace &&
|
3880
|
+
( event.which < tskeyCodes.space || ( event.which >= tskeyCodes.left && event.which <= tskeyCodes.down ) ) ) ) ) {
|
3860
3881
|
return;
|
3861
3882
|
}
|
3862
3883
|
// change event = no delay; last true flag tells getFilters to skip newest timed input
|
3863
3884
|
tsf.searching( table, true, true );
|
3864
3885
|
})
|
3865
|
-
|
3886
|
+
// include change for select - fixes #473
|
3887
|
+
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
|
3866
3888
|
// don't get cached data, in case data-column changes dynamically
|
3867
3889
|
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
3868
3890
|
// don't allow 'change' event to process if the input value is the same - fixes #685
|
3869
|
-
if ( wo.filter_initialized && ( event.which ===
|
3870
|
-
event
|
3891
|
+
if ( wo.filter_initialized && ( event.which === tskeyCodes.enter || event.type === 'search' ||
|
3892
|
+
// only "input" event fires in MS Edge when clicking the "x" to clear the search
|
3893
|
+
( event.type === 'change' || event.type === 'input' ) && this.value !== c.lastSearch[column] ) ) {
|
3871
3894
|
event.preventDefault();
|
3872
3895
|
// init search with no delay
|
3873
3896
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! TableSorter (FORK) v2.25.
|
1
|
+
/*! TableSorter (FORK) v2.25.2 *//*
|
2
2
|
* Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
@@ -21,7 +21,7 @@
|
|
21
21
|
'use strict';
|
22
22
|
var ts = $.tablesorter = {
|
23
23
|
|
24
|
-
version : '2.25.
|
24
|
+
version : '2.25.2',
|
25
25
|
|
26
26
|
parsers : [],
|
27
27
|
widgets : [],
|
@@ -190,6 +190,10 @@
|
|
190
190
|
bottom : false
|
191
191
|
},
|
192
192
|
|
193
|
+
keyCodes : {
|
194
|
+
enter : 13
|
195
|
+
},
|
196
|
+
|
193
197
|
// placeholder date parser data (globalize)
|
194
198
|
dates : {},
|
195
199
|
|
@@ -458,7 +462,7 @@
|
|
458
462
|
// only recognize left clicks
|
459
463
|
if ( ( ( e.which || e.button ) !== 1 && !type.match( ' ' + c.pointerClick + ' | sort | keyup ' ) ) ||
|
460
464
|
// allow pressing enter
|
461
|
-
( type === ' keyup ' && e.which !==
|
465
|
+
( type === ' keyup ' && e.which !== ts.keyCodes.enter ) ||
|
462
466
|
// allow triggering a click event (e.which is undefined) & ignore physical clicks
|
463
467
|
( type.match( ' ' + c.pointerClick + ' ' ) && typeof e.which !== 'undefined' ) ) {
|
464
468
|
return;
|
@@ -1046,8 +1050,8 @@
|
|
1046
1050
|
// find the footer
|
1047
1051
|
$headers = c.$table
|
1048
1052
|
.find( 'tfoot tr' )
|
1049
|
-
.add( $( c.namespace + '_extra_headers' ).children( 'tr' ) )
|
1050
1053
|
.children( 'td, th' )
|
1054
|
+
.add( $( c.namespace + '_extra_headers' ) )
|
1051
1055
|
.removeClass( css.join( ' ' ) );
|
1052
1056
|
// remove all header information
|
1053
1057
|
c.$headers
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 01-
|
7
|
+
/*! tablesorter (FORK) - updated 01-15-2016 (v2.25.2)*/
|
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 1/
|
375
|
+
/*! Widget: filter - updated 1/15/2016 (v2.25.2) *//*
|
376
376
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
377
377
|
* by Rob Garrison
|
378
378
|
*/
|
@@ -380,7 +380,8 @@
|
|
380
380
|
'use strict';
|
381
381
|
var tsf, tsfRegex,
|
382
382
|
ts = $.tablesorter || {},
|
383
|
-
tscss = ts.css
|
383
|
+
tscss = ts.css,
|
384
|
+
tskeyCodes = ts.keyCodes;
|
384
385
|
|
385
386
|
$.extend( tscss, {
|
386
387
|
filterRow : 'tablesorter-filter-row',
|
@@ -389,6 +390,14 @@
|
|
389
390
|
filterRowHide : 'hideme'
|
390
391
|
});
|
391
392
|
|
393
|
+
$.extend( tskeyCodes, {
|
394
|
+
backSpace : 8,
|
395
|
+
escape : 27,
|
396
|
+
space : 32,
|
397
|
+
left : 37,
|
398
|
+
down : 40
|
399
|
+
});
|
400
|
+
|
392
401
|
ts.addWidget({
|
393
402
|
id: 'filter',
|
394
403
|
priority: 50,
|
@@ -413,6 +422,7 @@
|
|
413
422
|
filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available ( visible ) options within the drop down
|
414
423
|
filter_placeholder : { search : '', select : '' }, // default placeholder text ( overridden by any header 'data-placeholder' setting )
|
415
424
|
filter_reset : null, // jQuery selector string of an element used to reset the filters
|
425
|
+
filter_resetOnEsc : true, // Reset filter input when the user presses escape - normalized across browsers
|
416
426
|
filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
|
417
427
|
filter_searchDelay : 300, // typing delay in milliseconds before starting a search
|
418
428
|
filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
|
@@ -1121,18 +1131,25 @@
|
|
1121
1131
|
ts.setFilters( table, c.$table.data( 'lastSearch' ) || [], internal === false );
|
1122
1132
|
}
|
1123
1133
|
// unbind events
|
1124
|
-
tmp = ( 'keypress keyup search change '.split( ' ' ).join( namespace + ' ' ) );
|
1134
|
+
tmp = ( 'keypress keyup keydown search change input '.split( ' ' ).join( namespace + ' ' ) );
|
1125
1135
|
$el
|
1126
1136
|
// use data attribute instead of jQuery data since the head is cloned without including
|
1127
1137
|
// the data/binding
|
1128
1138
|
.attr( 'data-lastSearchTime', new Date().getTime() )
|
1129
1139
|
.unbind( tmp.replace( ts.regex.spaces, ' ' ) )
|
1130
|
-
|
1140
|
+
.bind( 'keydown' + namespace, function( event ) {
|
1141
|
+
if ( event.which === tskeyCodes.escape && !wo.filter_resetOnEsc ) {
|
1142
|
+
// prevent keypress event
|
1143
|
+
return false;
|
1144
|
+
}
|
1145
|
+
})
|
1131
1146
|
.bind( 'keyup' + namespace, function( event ) {
|
1147
|
+
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
1132
1148
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
1133
1149
|
// emulate what webkit does.... escape clears the filter
|
1134
|
-
if ( event.which ===
|
1135
|
-
|
1150
|
+
if ( event.which === tskeyCodes.escape ) {
|
1151
|
+
// make sure to restore the last value on escape
|
1152
|
+
this.value = wo.filter_resetOnEsc ? '' : c.lastSearch[column];
|
1136
1153
|
// live search
|
1137
1154
|
} else if ( wo.filter_liveSearch === false ) {
|
1138
1155
|
return;
|
@@ -1141,19 +1158,21 @@
|
|
1141
1158
|
// liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace
|
1142
1159
|
( typeof wo.filter_liveSearch === 'number' && this.value.length < wo.filter_liveSearch ) ||
|
1143
1160
|
// let return & backspace continue on, but ignore arrows & non-valid characters
|
1144
|
-
( event.which !==
|
1145
|
-
( event.which <
|
1161
|
+
( event.which !== tskeyCodes.enter && event.which !== tskeyCodes.backSpace &&
|
1162
|
+
( event.which < tskeyCodes.space || ( event.which >= tskeyCodes.left && event.which <= tskeyCodes.down ) ) ) ) ) {
|
1146
1163
|
return;
|
1147
1164
|
}
|
1148
1165
|
// change event = no delay; last true flag tells getFilters to skip newest timed input
|
1149
1166
|
tsf.searching( table, true, true );
|
1150
1167
|
})
|
1151
|
-
|
1168
|
+
// include change for select - fixes #473
|
1169
|
+
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
|
1152
1170
|
// don't get cached data, in case data-column changes dynamically
|
1153
1171
|
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
1154
1172
|
// don't allow 'change' event to process if the input value is the same - fixes #685
|
1155
|
-
if ( wo.filter_initialized && ( event.which ===
|
1156
|
-
event
|
1173
|
+
if ( wo.filter_initialized && ( event.which === tskeyCodes.enter || event.type === 'search' ||
|
1174
|
+
// only "input" event fires in MS Edge when clicking the "x" to clear the search
|
1175
|
+
( event.type === 'change' || event.type === 'input' ) && this.value !== c.lastSearch[column] ) ) {
|
1157
1176
|
event.preventDefault();
|
1158
1177
|
// init search with no delay
|
1159
1178
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Parser: input & select - updated
|
1
|
+
/*! Parser: input & select - updated 1/15/2016 (v2.25.2) *//*
|
2
2
|
* for jQuery 1.7+ & tablesorter 2.7.11+
|
3
3
|
* Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
|
4
4
|
*/
|
@@ -158,16 +158,16 @@
|
|
158
158
|
$( ':focus' ).blur();
|
159
159
|
}
|
160
160
|
})
|
161
|
-
.on( 'focus' + namespace, 'select, input, textarea', function() {
|
161
|
+
.on( 'focus' + namespace, 'select, input:not([type=checkbox]), textarea', function() {
|
162
162
|
$( this ).data( 'ts-original-value', this.value );
|
163
163
|
})
|
164
|
-
.on( 'blur' + namespace, 'input, textarea', function() {
|
164
|
+
.on( 'blur' + namespace, 'input:not([type=checkbox]), textarea', function() {
|
165
165
|
// restore input value;
|
166
166
|
// 'change' is triggered before 'blur' so this doesn't replace the new update with the original
|
167
167
|
this.value = $( this ).data( 'ts-original-value' );
|
168
168
|
})
|
169
169
|
.on( 'change keyup '.split( ' ' ).join( namespace + ' ' ), 'select, input, textarea', function( event ) {
|
170
|
-
if ( event.which === 27 ) {
|
170
|
+
if ( event.which === 27 && !( this.nodeName === 'INPUT' && this.type === 'checkbox' ) ) {
|
171
171
|
// escape: restore original value
|
172
172
|
this.value = $( this ).data( 'ts-original-value' );
|
173
173
|
return;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Widget: filter - updated 1/
|
1
|
+
/*! Widget: filter - updated 1/15/2016 (v2.25.2) *//*
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* by Rob Garrison
|
4
4
|
*/
|
@@ -6,7 +6,8 @@
|
|
6
6
|
'use strict';
|
7
7
|
var tsf, tsfRegex,
|
8
8
|
ts = $.tablesorter || {},
|
9
|
-
tscss = ts.css
|
9
|
+
tscss = ts.css,
|
10
|
+
tskeyCodes = ts.keyCodes;
|
10
11
|
|
11
12
|
$.extend( tscss, {
|
12
13
|
filterRow : 'tablesorter-filter-row',
|
@@ -15,6 +16,14 @@
|
|
15
16
|
filterRowHide : 'hideme'
|
16
17
|
});
|
17
18
|
|
19
|
+
$.extend( tskeyCodes, {
|
20
|
+
backSpace : 8,
|
21
|
+
escape : 27,
|
22
|
+
space : 32,
|
23
|
+
left : 37,
|
24
|
+
down : 40
|
25
|
+
});
|
26
|
+
|
18
27
|
ts.addWidget({
|
19
28
|
id: 'filter',
|
20
29
|
priority: 50,
|
@@ -39,6 +48,7 @@
|
|
39
48
|
filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available ( visible ) options within the drop down
|
40
49
|
filter_placeholder : { search : '', select : '' }, // default placeholder text ( overridden by any header 'data-placeholder' setting )
|
41
50
|
filter_reset : null, // jQuery selector string of an element used to reset the filters
|
51
|
+
filter_resetOnEsc : true, // Reset filter input when the user presses escape - normalized across browsers
|
42
52
|
filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
|
43
53
|
filter_searchDelay : 300, // typing delay in milliseconds before starting a search
|
44
54
|
filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
|
@@ -747,18 +757,25 @@
|
|
747
757
|
ts.setFilters( table, c.$table.data( 'lastSearch' ) || [], internal === false );
|
748
758
|
}
|
749
759
|
// unbind events
|
750
|
-
tmp = ( 'keypress keyup search change '.split( ' ' ).join( namespace + ' ' ) );
|
760
|
+
tmp = ( 'keypress keyup keydown search change input '.split( ' ' ).join( namespace + ' ' ) );
|
751
761
|
$el
|
752
762
|
// use data attribute instead of jQuery data since the head is cloned without including
|
753
763
|
// the data/binding
|
754
764
|
.attr( 'data-lastSearchTime', new Date().getTime() )
|
755
765
|
.unbind( tmp.replace( ts.regex.spaces, ' ' ) )
|
756
|
-
|
766
|
+
.bind( 'keydown' + namespace, function( event ) {
|
767
|
+
if ( event.which === tskeyCodes.escape && !wo.filter_resetOnEsc ) {
|
768
|
+
// prevent keypress event
|
769
|
+
return false;
|
770
|
+
}
|
771
|
+
})
|
757
772
|
.bind( 'keyup' + namespace, function( event ) {
|
773
|
+
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
758
774
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
759
775
|
// emulate what webkit does.... escape clears the filter
|
760
|
-
if ( event.which ===
|
761
|
-
|
776
|
+
if ( event.which === tskeyCodes.escape ) {
|
777
|
+
// make sure to restore the last value on escape
|
778
|
+
this.value = wo.filter_resetOnEsc ? '' : c.lastSearch[column];
|
762
779
|
// live search
|
763
780
|
} else if ( wo.filter_liveSearch === false ) {
|
764
781
|
return;
|
@@ -767,19 +784,21 @@
|
|
767
784
|
// liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace
|
768
785
|
( typeof wo.filter_liveSearch === 'number' && this.value.length < wo.filter_liveSearch ) ||
|
769
786
|
// let return & backspace continue on, but ignore arrows & non-valid characters
|
770
|
-
( event.which !==
|
771
|
-
( event.which <
|
787
|
+
( event.which !== tskeyCodes.enter && event.which !== tskeyCodes.backSpace &&
|
788
|
+
( event.which < tskeyCodes.space || ( event.which >= tskeyCodes.left && event.which <= tskeyCodes.down ) ) ) ) ) {
|
772
789
|
return;
|
773
790
|
}
|
774
791
|
// change event = no delay; last true flag tells getFilters to skip newest timed input
|
775
792
|
tsf.searching( table, true, true );
|
776
793
|
})
|
777
|
-
|
794
|
+
// include change for select - fixes #473
|
795
|
+
.bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) {
|
778
796
|
// don't get cached data, in case data-column changes dynamically
|
779
797
|
var column = parseInt( $( this ).attr( 'data-column' ), 10 );
|
780
798
|
// don't allow 'change' event to process if the input value is the same - fixes #685
|
781
|
-
if ( wo.filter_initialized && ( event.which ===
|
782
|
-
event
|
799
|
+
if ( wo.filter_initialized && ( event.which === tskeyCodes.enter || event.type === 'search' ||
|
800
|
+
// only "input" event fires in MS Edge when clicking the "x" to clear the search
|
801
|
+
( event.type === 'change' || event.type === 'input' ) && this.value !== c.lastSearch[column] ) ) {
|
783
802
|
event.preventDefault();
|
784
803
|
// init search with no delay
|
785
804
|
$( this ).attr( 'data-lastSearchTime', new Date().getTime() );
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Widget: output - updated 1/
|
1
|
+
/*! Widget: output - updated 1/15/2016 (v2.25.2) *//*
|
2
2
|
* Requires tablesorter v2.8+ and jQuery 1.7+
|
3
3
|
* Modified from:
|
4
4
|
* HTML Table to CSV: http://www.kunalbabre.com/projects/table2CSV.php (License unknown?)
|
@@ -148,8 +148,11 @@
|
|
148
148
|
// all tbody rows
|
149
149
|
$rows = $el.children('tbody').children('tr');
|
150
150
|
|
151
|
-
//
|
152
|
-
|
151
|
+
// check for a filter callback function first! because
|
152
|
+
// /^f/.test(function(){ console.log('test'); }) is TRUE! (function is converted to a string)
|
153
|
+
$rows = typeof saveRows === 'function' ? $rows.filter(saveRows) :
|
154
|
+
// get (f)iltered, (v)isible, all rows (look for the first letter only), or jQuery filter selector
|
155
|
+
/^f/.test(saveRows) ? $rows.not('.' + (wo.filter_filteredRow || 'filtered') ) :
|
153
156
|
/^v/.test(saveRows) ? $rows.filter(':visible') :
|
154
157
|
// look for '.' (class selector), '#' (id selector),
|
155
158
|
// ':' (basic filters, e.g. ':not()') or '[' (attribute selector start)
|
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.20.
|
4
|
+
version: 1.20.2
|
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: 2016-01-
|
12
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.5.1
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: Simple integration of jquery-tablesorter (Mottie's fork) into the Rails asset
|