mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: Do not return altered filters. Fixes #1237
This commit is contained in:
parent
e96879baf7
commit
53bc869f3e
@ -629,14 +629,16 @@
|
||||
// encode or decode filters for storage; see #1026
|
||||
processFilters: function( filters, encode ) {
|
||||
var indx,
|
||||
// fixes #1237; previously returning an encoded "filters" value
|
||||
result = [],
|
||||
mode = encode ? encodeURIComponent : decodeURIComponent,
|
||||
len = filters.length;
|
||||
for ( indx = 0; indx < len; indx++ ) {
|
||||
if ( filters[ indx ] ) {
|
||||
filters[ indx ] = mode( filters[ indx ] );
|
||||
result[ indx ] = mode( filters[ indx ] );
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
return result;
|
||||
},
|
||||
setDefaults: function( table, c, wo ) {
|
||||
var isArray, saved, indx, col, $filters,
|
||||
|
@ -184,8 +184,9 @@ jQuery(function($){
|
||||
var processFilters = this.ts.filter.processFilters,
|
||||
filters = [],
|
||||
results = [];
|
||||
filters[1] = 5, filters[2] = 'test', filters[3] = true, filters[4] = null;
|
||||
results[1] = '5', results[2] = 'test', results[3] = 'true', results[4] = null;
|
||||
filters[1] = 5; filters[2] = 'test'; filters[3] = true; filters[4] = null;
|
||||
results[1] = '5'; results[2] = 'test'; results[3] = 'true';
|
||||
// filters[4] will now become undefined within results - see #1237
|
||||
|
||||
assert.deepEqual( processFilters( filters, true ), results );
|
||||
assert.deepEqual( processFilters( filters, false ), results );
|
||||
|
Loading…
Reference in New Issue
Block a user