Table of Contents
Setup:
Setup - Components
At minimum, you will need a data viewer (list or grid), a text input, and a button.
Setup - Data Table
In your local table table, add one column and name it anything. In this example, I named it “temp”. Set everything to 0 in that column.
Afterward, click the ‘Add Filter View’ button to create a new filter. Set up your filter like the following:
Explanation
With filter view, you can search for an item, but the problem is that you wouldn’t be able to display all items when you don’t want to search.
Let’s look at how we are setting the filter view.
Now we add a new filter rule. “temp = 0” will return all items where temp is 0 which is all items since we have all rows have temp set to 0. So this bottom filter rule will return all rows.
Now the “or” setting means that any items that fulfill any of these two conditions will be returned back to us. So under this rule, it will give us any rows where “Column 1” has “a”, or any rows where “temp” is 0. This will give us all rows.
Now how do we display everything and also search. Let’s take a look at the blocks.
By default without searching, if you try it out, it will display all items. What this blocks add is the ability to go from displaying all items to one specific item. When there is nothing searched for, we go back to our “default setting” where temp = 0. Temp = 0 means we want all rows.
But, if they type something in, we search for it in Column1 and we set temp = 1. With temp = 1, none of the rows have that set, so that will return nothing to us. The only item we are going to get are items where “Column1 = [whatever was searched for]”.
More Search Options
Let’s say we have multiple columns like below.
And we want to be able to search for either Column1 or Column2. All we have to do is add another filer rule like the one below:
And then we have to make changes to our blocks and components to include the option to search for either column1 or column2.