added filter_not option!
-
i needed a way to show all rows that DO NOT match the expression.
in tablepress-row-filter.php:added default setting for ‘filter_not’ shorcode attribute:
$default_atts['filter_not'] = false;
in filter_rows function, added where other vars initialized:
$filter_not = $render_options['filter_not'];
and changed following:
// Evaluate logic expressions. switch ( $compare ) { case 'none': case 'or': // At least one word was found / only filter word was found. if ( ! (in_array( true, $found, true ) ^ $filter_not ) ) { $hidden_rows[] = $row_idx; } break; case 'and': // If not (at least one word was *not* found) == all words were found. if ( in_array( false, $found, true ) ^ $filter_not ) { $hidden_rows[] = $row_idx; } break; }
(note exclusive or with $filter_not)
example use to show all rows that do not have green or blue in column A:
[table id=1 filter="green||blue" filter_columns="A" filter_not=true /]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘added filter_not option!’ is closed to new replies.