Prevent filter error. Fixes #432

This commit is contained in:
Mottie 2013-11-24 09:31:53 -06:00
parent 651957606d
commit 7b1699c955

View File

@ -635,13 +635,14 @@ ts.filter = {
c.$table.trigger('filterInit'); c.$table.trigger('filterInit');
}, },
setDefaults: function(table, c, wo) { setDefaults: function(table, c, wo) {
var indx, var indx, isArray,
filters = [], filters = [],
columns = c.columns; columns = c.columns;
if (wo.filter_saveFilters && ts.storage) { if (wo.filter_saveFilters && ts.storage) {
filters = ts.storage( table, 'tablesorter-filters' ) || []; filters = ts.storage( table, 'tablesorter-filters' ) || [];
isArray = $.isArray(filters);
// make sure we're not just saving an empty array // make sure we're not just saving an empty array
if (filters.join('') === '') { filters = []; } if (isArray && filters.join('') === '' || !isArray ) { filters = []; }
} }
// if not filters saved, then check default settings // if not filters saved, then check default settings
if (!filters.length) { if (!filters.length) {