Page 1 of 1

Preload a user-defined filter at runtime in list page

Posted: Sat Mar 25, 2023 1:13 am
by Andros

Hi, in the list page the user can use the advanced search to run a query, and then can save the filter with a specific name.
I want that if the filter name is "Default" when the user comes back to the list page that filter is applied and the list is filtered.
1) How can I do this?
2) Is there any way to save the filter for "Query builder" filters also?


Re: Preload a user-defined filter at runtime in list page

Posted: Sat Mar 25, 2023 9:28 am
by MichaelG

You can simulate the filter click event by using the following codes in Client Start up script:

if (this.filterList && this.filterList.filters) {
  setTimeout(function() {
      $(".ew-filter-option").find("button").click(); 
      var $filter = $(".ew-filter-option").find(".ew-reset-filter-list").filter(function () { return $(this).text() == "default"; });
      if ($filter)
          $filter.click();
  }, 1000);
}

NOTE THAT you need to add some checking to see if the default filter is loaded, or the page will be loaded repeatedly

It seems that currently Query Builder does not support save to filter