How to clean filters

I need to know how to clean the filters when the page is reloaded.

Hi @Pedro

Why do you need to clean the filters when the page was reloaded?
There is actually a Clear Filtering button under the Settings button.

Hi @larasmith

On a page_A you perform a sorting or filtering action and then go to another page_B and return to page_A, you keep the filter cache and roden , this is confusing for the user.

It would be nice to have the ability to clear the cache by code and not by user action.

I have managed to emulate the button click by means of jquery.

Awesome workaround you got there… I was thinking the same approach :blush:

Anyways we can also disable remembering the quick search by setting the:
‘remember_quick_search’ configuration to false :blush:

‘remember_quick_search’ is removed in Grocery CRUD version 3 as also per documentation: Migrating from v2 to v3 | Grocery CRUD v3 . However, I will create a new configuration for that since many people are asking for it.

In the meantime a quick work-around can be the below:

window.addEventListener('gcrud.datagrid.ready', () => {
    setTimeout(function () {
            document.querySelector(".grocery-crud .fa-broom").click();
    }, 500);
});

I am glad to announce you that on 3.0.8 we’ve introduced a new config named: remember_state_upon_refresh that you can switch it to false and it will not remember the previous state (e.g. search data, page… e.t.c.) upon refresh.

Let me know if that works for you.

Regards
Johnny

1 Like

This is awesome! :blush:
I can’t wait to upgrade to this version :blush: