Add Erase Filters buton

Hi guys,

Something I remember already have requested for the Filters of records inside the Builder, and now I am having the need for the Filters inside the Live App:

to add a Buton “Reset Filters”, for the obvious following reason:

when I have more than 2 filters it is fatser and easier to just click on a buton “Erase/Reset Filters”.

Thanks!
Michael

3 Likes

Hi, Michael!

Thanks for sharing this request! I’ve shared this with our Product team internally for consideration. :rocket:

Have a great week!

1 Like

Hey @MichaelG ,
Great idea! I know how cumbersome this can be when there’s a lot of filters.
While the team is considering this, you can use this simple slice of code to add an Erase filters button on the filters popup, which will clear all the filters once clicked.
I used an event handler that triggers on modal render mentioned in this forum post.

$(document).on('knack-modal-render', function() {
  var eraseFiltersLink = '<a id="erase-filters-link" class="kn-button" style="margin-left:.5em"><span class="icon is-small"><i class="fa fa-eraser"></i></span><span>Erase filters</span></a>';
  $('a#add-filter-link').after(eraseFiltersLink);

  $('#erase-filters-link').on('click', function() {
    $('a.remove-filter-link.kn-filter-remove').trigger('click');
  });
});

erasefilters

5 Likes

Hi @StephenChapman - Thank you for taking the time to come up with such an elegant solution :+1:

2 Likes

Tk you very much Stephen!

2 Likes

That works very nicely, thank you, Stephen.

2 Likes

Hi guys,

On the Filters subject, I am noticing various different behaviors between the App Live and the Builder. They should probably be exactly the same since it is for the same narrow purpose.

Here are some differences, and best ways:

BUILDER
:+1: having just 1 selection of and/or that replicate in all filters.
:+1: title is correctly Edit Filters
:-1: having an Add Filter button on each filter line

:-1: Having the Add filters button at the end.
:+1: Clicking Add filters, it adds one ONLY if there are no filters.

LIVE APP
You can see here the differences.

:-1: Clicking Add filters, it ALWAYS adds a new filter even if you do not want one, and just want to edit or erase a filter. Coherent with the name of the button, but incoherent with the functionality.

The text of the filter buttons should not be underlined. Cleaner and clearer.


As we saw, the initial button titled “Add filters”, serves also to Edit and Delete filter(s). So its name is more “Filters”, where inside the popup one does all, and only add one filter automatically if there are none.

image

1 Like