Reputation: 87
I want to filter my gallery on the rows where the toggle is value is set to true. I want to do this from outside my gallery with a button. Does anyone know how to do this?
My app looks like this:
I tried the following:
In the button on the OnSelect property I coded : Set(varFilter,"filter")
In the gallery on the Items property I coded: If (varFilter="filter", Filter(myData, ToggleName.Value=true), myData)
Upvotes: 0
Views: 2079
Reputation: 446
Since your toggle value is not stored in the database, you could add a Collect() function to the toggles' OnCheck property. This way every time a user checks a toggle, that item will be added to a collection.
OnCheck: Collect(colCheckedItems, ThisItem)
Then on your filter button's OnSelect, change the gallery's data source to now show your collection.
OnUncheck you'll have to add a remove from collection statement as well.
On visible of the screen, set a variable to false. Then on your button's OnSelect, toggle the variable between true/false:
If(varGalFiltered, Set(varGalFiltered, false), Set(varGalFiltered, true));
Update your gallery's Items property to switch the data source based on the variable:
If(varGalFiltered, colCheckedItems, myData)
Upvotes: 2