jQuery.FilterTable icon indicating copy to clipboard operation
jQuery.FilterTable copied to clipboard

no way to skip hiding rows

Open nmz787 opened this issue 3 years ago • 1 comments

I tried ignoreClass but the tr or td I have the associated class applied to are still hidden. This seems like an alternate meaning of "ignoring filtering", I also understand your original reasoning for it now (to skip finding a row/cell). Maybe there could be another option specifically to skip hiding, rather than skip finding?

nmz787 avatar Jun 14 '21 22:06 nmz787

Here's my quick patch, sorry for the code duplication of the actually showing:

--- a/static/sunnywalker-jQuery.FilterTable-8f7979d/jquery.filtertable.js
+++ b/static/sunnywalker-jQuery.FilterTable-8f7979d/jquery.filtertable.js
@@ -167,6 +167,9 @@
                 // don't filter the contents of these columns
                 ignoreColumns: [],

+                //never hide elements with this class applied
+                neverHide: '',
+
                 // use the element with this selector for the filter input field instead of creating one
                 inputSelector: null,

@@ -258,6 +261,9 @@
                         if (settings.ignoreClass) {
                             all_tds = all_tds.not('.' + settings.ignoreClass);
                         }
+                        if (settings.neverHide) {
+                            all_tds.filter('.' + settings.neverHide).addClass(settings.highlightClass).closest('tr').show().addClass(settings.visibleClass);
+                        }
                         // highlight (class=alt) only the cells that match the query and show their rows
                         all_tds.filter(':' + settings.filterExpression + '("' + q + '")').addClass(settings.highlightClass).closest('tr').show().addClass(settings.visibleClass);
                     }

nmz787 avatar Jun 15 '21 01:06 nmz787