I have managed to get my app to work, I now have 3 Galleries "Previous", "Recent" and CategoriesGallery. Once I clicked on an item in the CategoriesGallery, both "Previous" and "Recent" galleries only show the related items.
Once I click on All Button, it clears all the filters and both Galleries show all contents.
Now I want the All button to also reset the CategoriesGallery so the green color on the Selected item returns to its default color (Blue)
I am looking for something like
"Set(CurrentCategory, Blank()); Reset(CategoriesGallery)"
Please advise, its my first powerapps project.
Thanks
Roy
Other responses are incorrect in saying an item in the gallery must always be selected!
First set the default record to something that isn't in the gallery* to have it not select anything in the list. Then you can use the Reset function wherever needed.
Example:
Gallery1 - Default = {ItemHeading:"Blank"} (where ItemHeading is a field in each gallery record)
Button somewhere - OnClick = Reset(Gallery1)
*Note: you could use an If statement if for some reason you wanted an actual default record in the list the first time.
Hi @RoyGad ,
Firstly, you need to kown one important thing.
The gallery's selected item can not be set to blank.
It will always be an item.( the first item by default)
Even if you set the gallery's Default to empty, its selected item will be the first item.
So you need a little change on your formula.
I suggest you try this:
1)set the all button's OnSelect:
Set(var1,true) //use a variable to justify whether you click this button
2)set the label's Fill (inside the gallery):
If(var1,Blue,If(Gallery1.Selected.ID=ThisItem.ID,Green,Blue))
//if you click the button, all the items color becomr blue, or else the item will change based on selection item
set the label's OnSelect (inside the gallery):
Set(var1,false) //when you select item in the gallery, the variable value change
Best regards,
I think your code should work up to a point. The problem is that you can't have a gallery with a null selected property. Galleries always start out with a default selected record. This is normally the first record in the gallery, but you can change the default to point to any record. Doing a Reset won't clear the selected property. It will reset it back to the default, which normally would be the first record.
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional