Fixed issues with filter_columnFilters set to false. Fixes #355

This commit is contained in:
Mottie 2013-10-08 19:29:41 -05:00
parent d0adfe288f
commit ab5ceb9e1d

View File

@ -667,7 +667,7 @@ ts.addWidget({
buildDefault(true); buildDefault(true);
} }
if (e.type === 'filterReset') { if (e.type === 'filterReset') {
$t.find('.tablesorter-filter').val(''); searching([]);
} }
if (e.type === 'filterEnd') { if (e.type === 'filterEnd') {
buildDefault(true); buildDefault(true);
@ -786,10 +786,13 @@ ts.addWidget({
// add default values // add default values
$t.bind('tablesorter-initialized', function(){ $t.bind('tablesorter-initialized', function(){
ff = ts.getFilters(table); ff = ts.getFilters(table);
// ff is undefined when filter_columnFilters = false
if (ff) {
for (i = 0; i < ff.length; i++) { for (i = 0; i < ff.length; i++) {
ff[i] = $ths.filter('[data-column="' + i + '"]:last').attr(wo.filter_defaultAttrib) || ff[i]; ff[i] = $ths.filter('[data-column="' + i + '"]:last').attr(wo.filter_defaultAttrib) || ff[i];
} }
ts.setFilters(table, ff, true); ts.setFilters(table, ff, true);
}
}); });
// filter widget initialized // filter widget initialized
$t.trigger('filterInit'); $t.trigger('filterInit');