mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
parent
7269aadc74
commit
0107e93c94
@ -654,15 +654,21 @@ ts.filter = {
|
||||
c.$table.trigger('filterInit');
|
||||
},
|
||||
setDefaults: function(table, c, wo) {
|
||||
var isArray, saved,
|
||||
var isArray, saved, indx,
|
||||
// get current (default) filters
|
||||
filters = ts.getFilters(table);
|
||||
filters = ts.getFilters(table) || [];
|
||||
if (wo.filter_saveFilters && ts.storage) {
|
||||
saved = ts.storage( table, 'tablesorter-filters' ) || [];
|
||||
isArray = $.isArray(saved);
|
||||
// make sure we're not just getting an empty array
|
||||
if ( !(isArray && saved.join('') === '' || !isArray) ) { filters = saved; }
|
||||
}
|
||||
// if no filters saved, then check default settings
|
||||
if (filters.join('') === '') {
|
||||
for (indx = 0; indx < c.columns; indx++) {
|
||||
filters[indx] = c.$headers.filter('[data-column="' + indx + '"]:last').attr(wo.filter_defaultAttrib) || filters[indx];
|
||||
}
|
||||
}
|
||||
c.$table.data('lastSearch', filters);
|
||||
return filters;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user