cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Expansion/accordion with a gallery

I have a gallery that diaplys 6 Districts.I need to have an onselect for the label or a directional arrow that expands to show the retail locations of the district selected. My reserach has yielded nothing in terms of expandinf or accordion capabilities. I am consdiering auto fit galleries. I have also been playing around with visibility but to no avail. I used a checkbox and added to the oncheck/offcheck sections:

 

Label1.visible=True

 

Is that correct? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Expansion/accordion with a gallery

@Hockeyman9474, to answer your first question, I believe you need to use different variables for each gallery arrows... so you will have 3 variables expandCollapse - for example - expandCollapseDealer, expandCollapseDistrict and expandCollapseRegion.

 

However, I do not know how to answer your second question...

View solution in original post

19 REPLIES 19
Highlighted
Community Support
Community Support

Re: Expansion/accordion with a gallery

Hi @Hockeyman9474,

 

Based on my understanding, I think here you could add another gallery (Gallery 2), then change its items property with the code below:

Filter(RetailLocationsTable, Districts=Gallery1.selected.Dustricts)

For selection, change the Onselect property of the Label or the directional arrow to navigate to the Gallery2 screen, then under gallery 2 screen, add a button to navigate back.

For Visible property, we can't assign values to the visible property of controls in formula, but we could write formula with the visible property.

For example, you would like to configure the visible property of Label1 on condition of some action (For example, pressing a button), then with the visible property of the label1 control, we could use:

If (Button.pressed, true, false)

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: Expansion/accordion with a gallery

Hi @Hockeyman9474

 

Have you seen this blog?

https://powerapps.microsoft.com/en-us/blog/ux-patterns-expander-control-with-expand-collapse-animati...

 

I have successfully managed to achieve an expandable gallery with this. Also, as suggested by @v-micsh-msft instead of using a label inside the gallery, I am using a second gallery filtered based on the parrent gallery.

 

Hope this helps 🙂 if you need more details, let me know

Highlighted
Helper III
Helper III

Re: Expansion/accordion with a gallery

Yes but it's confusing and I don't understand it. The poster doesn't elaborate very much. For example I don't have the expander tool, and the poster isn't specific so it's hard to follow. Can't I add a flexible height gallery and make it visible by clicking an arrow? Why is this concept so hard to apply when it's such a common occurence. Powerapps is not very intuitive when it comes to this. Big limitation in my oppinion.

Highlighted
Anonymous
Not applicable

Re: Expansion/accordion with a gallery

@Hockeyman9474

Let me try to explain how I have achieved this.

 

First use a 'Blank flexible height' gallery.

Add a label to display the District name and under that add another 'Blank flexible height' gallery which will display the locaitons in the district selected.

Now insert 2 icons: 'Up' (collpase) and 'Down' (expand) so that they are one on top of the other one and set the following properties on them

1. for the 'Up' (collapse) button:

- Visible: expandCollapse && ThisItem.IsSelected

- OnSelect: UpdateContext({expandCollapse:false})

2. for the 'Down' (expand) button:

- Visible: Not(expandCollapse && ThisItem.IsSelected)

- OnSelect: UpdateContext({expandCollapse:true})

Then on the second gallery set the Height to be If(expandCollapse && ThisItem.IsSelected,190,0) - adjust to your needs.

 

This should create a basic accordion gallery with minor tweaks to reflect your data sources. 

 

Hope this makes it clearer 🙂 

 

 

Highlighted
Helper III
Helper III

Re: Expansion/accordion with a gallery

Followed all instructions and expand button not visible now and collapse does nothing when I click on it. To follow th eloginc:

We created a gallery and a sub gallery both blank,auto scaling. We added to buttons and renamed them expand and collapse. This is where I get lost. We use "NOT" as a means of saying do not show? Before renamingicons i noticed the expandCollapse didn't show as an option. Does the smart function combine the two? Also, what purpose does the timer serve? Shouldn't we have the timer set to true when I click the expand? Logic also leads me to belive the timer should be set to true when I expand, but then again, I don't understand the concept of the timer.

Highlighted
Anonymous
Not applicable

Re: Expansion/accordion with a gallery

I have just created a new app and followed the above instructions andI have found the problem - the visible functions needs to be the other way around:

The expand button will have: Not(expandCollapse && ThisItem.IsSelected)

and the collapse button will have: expandCollapse && ThisItem.IsSelected

 

ex.png

 

The 'expandCollapse' is a context variable that gets created and updated through UpdateContext function, it can be name anything.

The NOT helps to negate the validation, so only one button is visible at a time. 

 

I'm not sure on the timer either, I think it has more to do with the animation than with the collapse/expand function as I have manage to create it witouth it.

 

Let me know if this works 🙂 

Highlighted
Anonymous
Not applicable

Re: Expansion/accordion with a gallery

I have just created a new app and followed the above instructions and have found the problem - the visible functions needs to be the other way around:

The expand button will have: Not(expandCollapse && ThisItem.IsSelected)

and the collapse button will have: expandCollapse && ThisItem.IsSelected

 

ex.png

 

The 'expandCollapse' is a context variable that gets created and updated through UpdateContext function, it can be name anything.

The NOT helps to negate the validation, so only one button is visible at a time. 

 

I'm not sure on the timer either, I think it has more to do with the animation than with the collapse/expand function as I have manage to create it without it.

 

Let me know if this works 🙂 

Highlighted
Helper III
Helper III

Re: Expansion/accordion with a gallery

one more thing to consider:

 

the collapse button has two sets of visible and on select values. Which do I follow. I'm going to write this out, please correct:

 

Collapse Button

Visible: expandCollapse && ThisItem.IsSelected)

OnSelect: UpdateContext ({startTimer:true});UpdateContext{(expandCollapse:false)}

 

correct?

Highlighted
Helper III
Helper III

Re: Expansion/accordion with a gallery

Incredible it worked. Will you kindly reply one last time explaining each step so I understand as opposed to just doing what you say to do.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

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