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

Clear filter from gallery

Hi all,

 

I have a gallery that has its records being filtered. I want is a button or something for the filter to be removed and for all records to display like they did before being filtered. When I select an item from Gallery1, items in the table that have a matching location display on Gallery2. Gallery1 is just a gallery that displays a list of locations. 

 

Gallery1- Items: 

Distinct(SortByColumns(Testing_Database,"Location"), Location)

 

Gallery2- Items:

Filter(Search(Testing_Database,'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), Location = Gallery1.Selected.Result)

 

I've also realized that the search bar searches the entire table instead of just the items being filtered when the user selects a filter. Of course, if the user selects a filter they would only want to search through the filtered list not the entire table. How can I fix this?

1 ACCEPTED SOLUTION

Accepted Solutions
Sienna
Level 10

Re: Clear filter from gallery

If you want to search in filtered table then you have to put filter inside the search. Something like this

Gallery2- Items:
Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality")

For the button to cancel filtering and display whole table, insert button and in OnSelect proerty add

UpdateContext({filterOn:!true})

And in yout gallery items change it to something like this

If(filterOn=true, Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), TestingDatabase)

View solution in original post

2 REPLIES 2
Sienna
Level 10

Re: Clear filter from gallery

If you want to search in filtered table then you have to put filter inside the search. Something like this

Gallery2- Items:
Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality")

For the button to cancel filtering and display whole table, insert button and in OnSelect proerty add

UpdateContext({filterOn:!true})

And in yout gallery items change it to something like this

If(filterOn=true, Search(Filter(Testing_Database,Location = Gallery1.Selected.Result),'Textbox Search'.Text, "Artist","Title","Location","Medium","Nationality"), TestingDatabase)

View solution in original post

Vanilla
Level: Powered On

Re: Clear filter from gallery

Thanks Sienna, it worked. Now the filter from the gallery can be cleared with a button and only the filtered results are being searched.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

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 (Last 30 Days)
Users online (5,860)