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

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
MelindaK
Level 8

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...

MelindaK

View solution in original post

19 REPLIES 19
Community Support Team
Community Support Team

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.
MelindaK
Level 8

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

MelindaK
Hockeyman9474
Level: Powered On

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
MelindaK
Level 8

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 🙂 

 

 

MelindaK
Hockeyman9474
Level: Powered On

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.

MelindaK
Level 8

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 🙂 

MelindaK
MelindaK
Level 8

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 🙂 

MelindaK
Hockeyman9474
Level: Powered On

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?

Hockeyman9474
Level: Powered On

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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,428)