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

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
Level: Powered On

Re: How to set gallery to display all items by default

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
Super User
Super User

Re: How to set gallery to display all items by default

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.
Vanilla
Level: Powered On

Re: How to set gallery to display all items by default

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
Level: Powered On

Re: How to set gallery to display all items by default

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
thirdimage

Power Platform 24

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

Top Solution Authors
Top Kudoed Authors
Users online (6,014)