diff --git a/js/widgets/widget-filter.js b/js/widgets/widget-filter.js index 8fc3dbfd..fef34caa 100644 --- a/js/widgets/widget-filter.js +++ b/js/widgets/widget-filter.js @@ -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, diff --git a/testing/testing-widgets.js b/testing/testing-widgets.js index 87962372..a6124314 100644 --- a/testing/testing-widgets.js +++ b/testing/testing-widgets.js @@ -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 );