Filtering lists/tables

From Fabrik

(Redirected from Filtering tables)
Jump to: navigation, search


Filters can be applied to a Fabrik table via the following means:

  • Querystrings
  • Pre-filters
  • Element filters
  • The table search all filter
  • Filter form


Regardless of which method is used the filters are stored in the session (which means that their results are 'sticky' and will be applied each time the table is viewed


Contents

Filtering via the query string

The simplest way to filter in the querystring is to append "&tablename___elmentname=value" to it

URL date filters accept times that can be converted using PHP's strtotime function (http://php.net/strtotime)

If you want to match upcoming records for the next 2 weeks you can do this:

?tablename___time_date[value][]=now&tablename___time_date[value][]=%2B2 week&tablename___time_date[condition]=BETWEEN

note the "%2B" in the second date value is the url encoded version of '+'


If you want to match the records from last week you can do this:

?tablename___time_date[value][]=-1 week&tablename___time_date[value][]=now&tablename___time_date[condition]=BETWEEN


If you want to filter on a series of values for the same element do this:

?&tablename___elementname[value][]=64&tablename___elementname[value][]=126&tablename___elementname[value][]=127&tablename___elementname[join]=OR

If you want to filter on a value 'foo' in either element 'A' or 'B' then do this:

?tablename___A[value]=foo&tablename___A[join]=OR&tablename___B[value]=foo&tablename___B[join]=OR

The available 'conditions' are:

  • BETWEEN
  • BEGINS WITH
  • CONTAINS
  • ENDS WITH
  • >
  • <
  • <>

Querystring filtering to Search Across All Fields:


There are two variables you can use to filter data across all of the table's fields:


Fabrik2:

  • fabrik_table_filter_all - This defines the value to search for
  • search-mode-advanced - If your table has its 'advanced search mode' turned on, then Fabrik will use boolean full text matchingThis has the additional option to specify how to search the data:
    • all - search for all the words
    • any - search for any of the words
    • exact - search for the exact phrase
    • none - search for all records which don't contain the value


e.gto find all records which don't contain '666' then add this to your table's url:

?fabrik_table_filter_all=666&search-mode-advanced=none

Fabrik3:

  • fabrik_list_filter_all_X_com_fabrik_X  (X is the list ID)

  • e.g to find all records which contain 'abc' then add this to your list's url:
&fabrik_list_filter_all_22_com_fabrik_22=abc

Element Filters


For each element you have the option to add a filter to the table view, allowing your users to filter the table data.For information about the individual element filter settings see here.

Clearing filters

You can clear the filters by pressing the 'clear' button at the top of the filter tableThis will remove all the users filters from their session, but will still apply the table's prefilters

In addition you can pass in variables via the querystring to clear and/or reset filters

clearfilters=1 : will clear the prvious filters and not apply any other filters except prefilters (has the same behaviour as the 'clear' button

resetfilters=1 : will clear previous filters and apply any current querystring filters and prefilters

clearorder=1 : will clear any ordering that has been applied to the table view.

Ordering list data via the querystring

For ordering data via the querystring please see sorting list data

Personal tools