Untitled

Filters allow you to find the necessary records in collections. To do this, you need to set one or more filters according to conditions that complement each other.

Main Elements

https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/66153380-dda4-4c81-9852-6d82838a820b/Untitled.png

Let's take a closer look at the filter panel:

  1. Filter icon The filter modal opens when you click on the filter icon. If a filter is applied, a counter is displayed with the number of active filters (including those inside groups).
  2. Filter conditions AND - all conditions must be met; OR - one of the conditions must be met; By default, the AND condition is selected. You can switch it and immediately see changes in the filter results.
  3. Filter reset button Clicking on clear all resets all filters.
  4. Modal close button Clicking on X closes the modal.
  5. Filter group In CMS, you can create filter groups. This is used when some filters need to be collected with a different condition i.e not like in the modal header. There can be many groups, but a group cannot be nested in another group.
  6. Filter list All added filters that are not in a group.
  7. Adding new filters The Add filter button allows you to add new filter lines.

Filter state

https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/8b6872e1-bfb9-4158-ba95-1598979aab40/Untitled.png

Filters can be in the following states:

  1. Active Filters that have been added, configured, and activated by clicking . Such filters participate in filtering.

  2. Inactive Filters that have been added. But the button was not pressed. The name of such a filter is colored in gray and it lacks a filter work description (for example contain "Urban Outfitters"). Such a filter is displayed in the list, but does not participate in filtering. You can always open, configure, and activate such filters. This might be useful: when there is a list of necessary filters and you first add them and only then configure them.

  3. Editing A filter goes into the editing state when adding a new filter or when clicking on an existing one. The editing screen consists of 3 parts: input (depending on the filtering method), control buttons (you can delete the filter or save), filtering methods of the selected field (see Filtering methods ). Only one filter can be in editing mode at a time.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/4168f27b-7243-4375-8f15-185522d9d879/Untitled.png

Context Menu

https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/ae008fbe-6931-41bc-8ba1-a7310881257f/Untitled.png

To call the context menu, you need to click on the grip icon. There are 3 options: Create a group, duplicate, and delete.

When duplicating a filter, the duplicate immediately opens in edit mode.

<aside> ⚠️ Filters inside a group only have two options: duplication and deletion. This means that a group cannot be created within a group.

</aside>

Adding Filters

Our task: to find Urban Outfitters products that are on sale.

  1. Let's add the first filter condition. Click on add filter

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/dc4f6e73-cf60-4a0e-961e-00f5b7a2edb2/Untitled.png

  2. Select brands from the list of fields.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/b5697581-28c7-447f-897f-9346ca5f414c/Untitled.png

  3. After adding a field, it opens in edit mode When adding a field, the first filter method in the list is selected. In our case, it's contain (see Filtering methods ). As long as the input is empty or an option is not selected, the button is not active. Until it is pressed, the filter does not participate in the search.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/37658dd5-d1d1-47b8-bb64-6d4e41a21df5/Untitled.png

  4. Select Urban Outfitters from the dropdown list of brands. The default filter method is contain which is what we need. Click on .

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/7fa8b218-2552-4d22-a31e-b357422fd5e8/Untitled.png

  5. The first field has been added. We can see that only Urban Outfitters products are left in the list. All that's left is to add another filter for discounted products.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/f695d54e-3686-4306-92c6-aa0e3e213c9f/Untitled.png

  6. Let's click on Add filter and select Sale from the list of fields.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/3ac9c39b-6745-4120-932e-d0023278d82a/Untitled.png

  7. The Boolean field type only has True, False methods. It doesn't have input or option selection. By default, the first method True is selected. The button is already active. We need the discount to be enabled. Click on and save the filter.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/d9092216-6f50-4b16-91a8-1f6af156adc3/Untitled.png

  8. Done! We have filtered out products that have a discount and filtered by the required brand.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/c07cc5b9-6900-4f24-98f7-c07290212aff/Untitled.png

Creating group

Task: Find discounted products from the Urban Outfitters and Fatboy brands. Since we have a conflict of AND and OR conditions, we will use groups in filters. We need to assemble a scheme - (Urban Outfitters or Fatboy) and sale.

  1. Let's start by creating a group for brand filters. To do this, we need to select an existing filter and make it a group through the context menu. We already have a filter for Urban Outfitters. Click on the icon to call the context menu.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/580f8fdf-2aaf-4d81-88e2-5c0fe6501bd0/Untitled.png

  2. In the context menu, select Group.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/04abc5db-7b38-4c10-ae98-63bb5cf93521/Untitled.png

  3. Group is created. Note: when a group is created, it is created with the and condition. We switch it to or because we want to find discounted products from two brands.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/a29a66fc-fc2f-471c-859e-d8a087213a26/Untitled.png

  4. Now we need to add a new filter for the Fatboys brand. We can add a new filter through the add filter button or by duplicating an existing filter. Let's try the second option. To do this, open the context menu and select dublicate.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/aad05d5a-8362-4628-be71-7fe2097f6bc8/Untitled.png

  5. The filter is duplicated. Click on it to edit the filter.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/6d4ab3d7-f53e-40b5-8b8d-60b28ba33ec5/Untitled.png

  6. The filter has switched to edit mode. Leave contain, Select the Fatboy brand and click .

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/ea3eae49-6c46-46f1-919b-98e7ae8ca451/Untitled.png

  7. Done! Only discounted products and brands Fatboy and Urban Outfitters are displayed in the collection.

    https://prod-files-secure.s3.us-west-2.amazonaws.com/77b19e1f-fa29-4251-a818-bada7857b56b/c0ad195b-1e99-4fa7-8ee0-fb59f4bf73f4/Untitled.png

Edge cases

  1. If you delete the last record in a group, the group does not get deleted. You can add new filters to it. You can delete a group by clicking the trash can icon in the group header.

  2. If during the addition of a new filter you do not click on and close the modal, add a new filter or open editing of another one, the filter will remain inactive.

  3. If during the editing of an active filter you do not click on and close the modal, add a new filter or open editing of another one, the filter will remain active, but will not save changes.

  4. If no records are found as a result of filtering, we see the following message.

    Untitled

<aside> 🔖 Read more on this topic ——————————— Filtering methods Sorting Sorting methods Visibility

</aside>