Filter: Do not return altered filters. Fixes #1237

This commit is contained in:
Rob Garrison 2016-06-28 06:13:39 -05:00
parent e96879baf7
commit 53bc869f3e
No known key found for this signature in database
GPG Key ID: 0A42D160D71978E1
2 changed files with 7 additions and 4 deletions

View File

@ -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,

View File

@ -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 );