cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JDH138
Helper I
Helper I

Create an "All" option for cascading dropdowns applied to a gallery

Hello everyone. I have built a simple app that filters and searches through a gallery (Sharepoint List Datasource). The "Category and Sub-category are cascading dropdowns as each Category could have multiple subcategories. I have the app programmed to default to "All" on the category dropdown so that all categories can be seen simultaneously. I did this by adding this code to the App "Onstart" field. 

JDH138_2-1631630965254.png

The collection then populates the Category dropdown, giving the "All" option that displays all categories. 

JDH138_3-1631631019631.png

Here is the code in the "items" Property of the gallery.

JDH138_5-1631631561661.png

 

 

Here is an example of when "All" is selected in the Category Dropdown. (The subcategory dropdown appears when anything other than "All" is selected)

JDH138_0-1631630598228.png

My issue comes when I select a certain category from the Category dropdown, I would like to create and default to an "All" option at the top of the dropdown for each subcategory once a category is selected in order to avoid it auto choosing the first value in the subcategory dropdown (In this case its "IRA". Basically, I would like to allow a user to see all subcategories in the gallery for a certain category when chosen. Like so. Does anyone have any ideas, workaround, advice? Thanks a lot!

JDH138_4-1631631425599.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

No,

Since it's a picture i can't copy the code but it's something like this:

Filter('Policy Library', Category = Dropdown1.Selected.Value || Dropdown1.Selected.Value= "All",

 Subcategory= Dropdown2.Selected.Value || Dropdown2.Selected.Value= Blank() )

View solution in original post

7 REPLIES 7
zmansuri
Super User
Super User

in your subcategory dropdown make Allowempty property true.

in your filter code add for blank condition.

Subcat.Value = DropDown.Selected.Value || DropDown.Selected.Value = Blank()

Salem
Helper II
Helper II

I would add to @zmansuri solution:

Replace the dropdown with a combobox and set "InputTextPlaceholder property" to "All" which will show the value you want "All" without having to select any value.

Also make sure "Select Multiple" is false.

Salem_0-1631634725431.png

 

Thanks for the reply! Am adding this in right? (The highlighted portion)

Dropdown1 = Category

Dropdown2 = Subcategory

JDH138_1-1631635451035.png

 

 

No,

Since it's a picture i can't copy the code but it's something like this:

Filter('Policy Library', Category = Dropdown1.Selected.Value || Dropdown1.Selected.Value= "All",

 Subcategory= Dropdown2.Selected.Value || Dropdown2.Selected.Value= Blank() )

Will this work with the following formula being used in the dropdown(Or combobox)?

JDH138_0-1631635979896.png

 

Distinct(Filter('Policy Library', Category = Dropdown1.Selected.Result),SubCategory).Result

I have an additional question if you don't mind helping me out. When I select a category it shows all subcategories just like I wanted.

JDH138_0-1631662431651.png

Once I select a subcategory and then try to change back to the "All" items view, the blank space is gone and only gives the option to select the subcategories separately UNLESS I reselect the selected item. Any ideas on how to have the blank "All" option as a constant in the dropdown? Thanks!

JDH138_1-1631662589972.png

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,656)