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.
The collection then populates the Category dropdown, giving the "All" option that displays all categories.
Here is the code in the "items" Property of the gallery.
Here is an example of when "All" is selected in the Category Dropdown. (The subcategory dropdown appears when anything other than "All" is selected)
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!
Solved! Go to Solution.
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() )
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()
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.
Thanks for the reply! Am adding this in right? (The highlighted portion)
Dropdown1 = Category
Dropdown2 = Subcategory
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)?
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.
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!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
199 | |
99 | |
59 | |
58 | |
55 |
User | Count |
---|---|
257 | |
161 | |
88 | |
79 | |
68 |