cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RoyGad
Level: Powered On

how to clear the selected items in a Gallery

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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: how to clear the selected items in a Gallery

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 change10218.PNG

 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: how to clear the selected items in a Gallery

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: how to clear the selected items in a Gallery

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 change10218.PNG

 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,867)