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, andSearchin the [Label] of the placed [Input], [Select], [Input], and [Button] respectively. - Select the [Input] for
Filter by Ratingand 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 Firebaseas the data source. - Choose [List documents] in [Action] and enter
productsin [Collection]. - Add three filters from [Add Filter].
- For the first filter, select
==, entertitlein [Key], and{{ input1.value }}in [Value]. - For the second filter, select
==, entercategoryin [Key], and{{ select1.value }}in [Value]. - For the third filter, select
>=, enterratein [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 Firebaseas the data source. - Choose [List documents] in [Action] and enter
categoriesin [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
listProductsin [Dataflow] of the [Inspect].