cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vanilla
Frequent Visitor

How to set gallery to display all items by default

Hi all,

 

I want a gallery to display all of the items in the data source when the gallery launches. Right now nothing displays by default, which is not what I want. When I type characters into the textbox matching items in the gallery display. When I select an item from Gallery1, items in the table that have a matching location display correctly 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)

1 ACCEPTED SOLUTION

Accepted Solutions
Vanilla
Frequent Visitor

What I ended up doing was duplicating the gallery and searchbar and setting the items of the duplicated gallery to:

Search(Testing_Database,'Textbox Search_1'.Text, "Artist","Title","Location","Medium","Nationality")

 

and the visible property to: If(IsBlank(Gallery1.Selected.Result), true, false)

 

So the screen always displays gallery2 and  the duplicate gallery at the initial load of the screen, but only displays gallery2 if the user users gallery1 to filter by location.

 

View solution in original post

3 REPLIES 3
Jeff_Thorpe
Super User
Super User

You can do this as long as Gallery1 doesn't have anything selected. What you can do is use an "If" statement and it would look something like this:

 

If(IsBlank(Gallery1.Selected), DataSource, Filter(DataSource, Gallery1.Selected.Results = Location))

 

If it still looks like it is being filtered then there is a good chance that something is selected in Gallery1. To test that out you would need to add a label to the screen and give the text property the formula of "Gallery1.Selected.Results" and see if it has a value.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

I've set the items property of gallery2 to 

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

 

The formula isn't giving any errors and I think it should work but it still isn't displaying any records unless I search for something or use gallery1 to select a location to filter by. I used a label to make sure nothing was being selected in gallery1 and if something was selected it displayed the text of the location as expected. 

Vanilla
Frequent Visitor

What I ended up doing was duplicating the gallery and searchbar and setting the items of the duplicated gallery to:

Search(Testing_Database,'Textbox Search_1'.Text, "Artist","Title","Location","Medium","Nationality")

 

and the visible property to: If(IsBlank(Gallery1.Selected.Result), true, false)

 

So the screen always displays gallery2 and  the duplicate gallery at the initial load of the screen, but only displays gallery2 if the user users gallery1 to filter by location.

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,678)