Hi all!
I have a repeating gallery (for a timecard) and I'm trying to expand/collapse some of the items in my gallery when I click a button. The only issue I'm running into is when I 'repeat' the gallery it's expanding/collapsing everything instead of the specific items relevant to that submission.
As you can see in the picture, I want to expand/collapse each individual entry instead of all of the entries. The issue is I'm not sure how to set the visible property EACH SPECIFIC CONTROL instead of all the controls.
Any help is greatly appreciated!
Thank you!
@Anonymous
Actually, the LookUp function is excessive in this case and you can use: ThisItem.ID in colExp instead.
@Anonymous
So, here is what you need to do. I will use a collection method in this case even though it is a bit of an overkill.
First, you WILL need a flexible height gallery! There is no getting around that.
Next, on the expand collapse icon, set the following:
Icon - If(LookUp(colExp, ID=ThisItem.ID, true), Icon.Collapse, Icon.Expand)
OnSelect - If(LookUp(colExp, ID=ThisItem.ID, true), RemoveIf(colExp, ID=ThisItem.ID), Collect(colExp, {ID:ThisItem.ID}))
Then, for the Visible property of the items in your gallery (and you can group them as @PowerRanger suggested, or reference them - i.e. One visible property controls the rest) set the property to: LookUp(colExp, ID=ThisItem.ID, true)
That should give you what you need.
Groups are just fine (although annoying at times), but the common misunderstanding is that the "Group" is a control by itself that has a Visible, OnSelect, etc. on it...It does not, it is just a convenience to select a group and set a Visible, but it is NOT setting a Visible on a "Group" it is setting the visible on ALL of the control in the group.
The annoying part is that you can easily destroy existing formulas with that process. So, if you had a control with a formula in the Visible property and then you grouped it with others and then set the Visible property on the "group" then you will be wiping out the existing Visible property on that particular control.
But in the case of the gallery "real estate", even grouping them will not cause the gallery to change height unless it is in a flexible gallery.
It was true given the qualifier "afaik" :D. I didn't know about the flexible height gallery. I'm glad to know about it now.
@RandyHayes You are totally right and I am absolutely aware of that. But to keep life easier I thought using a group here would make sense. 🙂
Hey Randy! So I have a collection taking in all of these values.
The reason the expand/collapse button is currently OUTSIDE of the gallery is because I couldn't get the expand/collapse function to work inside of the gallery. That being said I'm trying to move it into the gallery to make it work.
What I was initially trying to do was to make the onvisible property look like this:
Set(VarShowID, Sum(COLLECTION,ThisItem.ID)) and then the visible property for the controls (I.E. the group) was if(varShowID=Sum(COLLECTION,ThisItem.ID),true,false). I still am running into the issue of EVERYTHING expanding/collapsing instead of just the specific entry.
Also, see the image below for what I am attempting to make visible/unvisible. Thank you!
Please keep in mind that there is no such thing as a "Group" in PowerApps. When you Group your controls, you are just grouping them together in a convenient way. So, while you think you might be setting the Visible property of the "Group" to something, you are really setting the Visible property of ALL the controls inside the group. This is an important distinction!
@Anonymous your issue is that you are trying to use a single variable to expand and collapse multiple rows of multiple records. So, in a sense, you would need multiple variables. That is not practical in PowerApps this way. So utilizing a more elaborate variable or a collection (in-memory database) to determine expansion/collapse is needed.
I am not seeing what it is that you want to expand or collapse as per the record/row of the gallery. Your expand collapse is outside of the gallery, so it is assumed that you DO want to expand and collapse all items.
As for the spacing in the gallery - you need to use a Flexible Height gallery for what you are trying to do.
I hope this is helpful for you.
@Anonymous
@sopatte that's not true.
Steps to build something like you require:
1. Use a Gallery "Blank flexible height"
2. Try to build something like I did. Have a look at the tree view
3. To Group controls you just select all controls you want to group, left cklick and Group
4. Select the group and use this for the OnVisible property
ThisItem.ID = varItemID
5. On the button OnSelect use
Set(varItemID,ThisItem.ID)
Play the app and test it
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I'm running into the same issue - it expands and collapses all groups instead of just for each specific entry.
I've wondered about this before. You can show or hide controls per item but afaik there is no way to have a gallery with varying heights per item.
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473