Filtering Data in a Table
Display and filter product data stored in Firestore by product name, category, and rating
Place Components
- Place a [Column].
- Add two items from the [+] button inside the [Column].
- In sequence from left to right within the [Column], place [Input], [Select], [Input], and [Button].
- Place a [Table] below the [Column].
- Enter
Filter by Product Name
,Filter by Category
,Filter by Rating
, andSearch
in the [Label] of the placed [Input], [Select], [Input], and [Button] respectively. - Select the [Input] for
Filter by Rating
and choose [Number] for the [Type].
Display a Filterable Product List in a Table
- Click [Create] in [Dataflows] and change the dataflow name to
listProducts
. - Select
Onboarding Firebase
as the data source. - Choose [List documents] in [Action] and enter
products
in [Collection]. - Add three filters from [Add Filter].
- For the first filter, select
==
, entertitle
in [Key], and{{ input1.value }}
in [Value]. - For the second filter, select
==
, entercategory
in [Key], and{{ select1.value }}
in [Value]. - For the third filter, select
>=
, enterrate
in [Key], and{{ input2.value }}
in [Value]. - Click [Run], and with the table selected, enter
{{ listProducts.data }}
in [Data] of the [Inspect].
Retrieve Categories to Display in Select and Link Dataflow to Search Button
- Click [Create] in [Dataflows] and change the dataflow name to
listCategories
. - Select
Onboarding Firebase
as the data source. - Choose [List documents] in [Action] and enter
categories
in [Collection]. - Click [Run], and in the [Inspect] of the select, enter
{{ listCategories.data.map(d => d.name) }}
for both [Values] and [Labels]. - With the button selected, choose
listProducts
in [Dataflow] of the [Inspect].