web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery controls react...
Power Apps
Answered

Gallery controls reacting simultaneously for all the items

(0) ShareShare
ReportReport
Posted on by 447

Hello !

 

Hope you are all doing good.

 

I created a SharePoint and am customizing a form for it.

In this form i have a gallery to display and edit the content of my list. 

I added several controls in my gallery to do as an actions menu. The problem when i open this menu in 1 item is it opens it in all the items (also If i click the button "Edit" that toggles my gallery from display mode to edit, it does it for all the items not only for the current one...and it seems to be doing the same for the save and remove actions)

PXL_20210523_063227903.jpg

 

in the elipsis icon's OnSelect, I have :  UpdateContect({varMenu:!varMenu})   so when i click the button it opens and closes the label that contains the bettons.

 

The Visible property of the label contains If(varMenu,true,false)

 

and then the icons on the label have specific (long) functions ...that also apply to all the records.

would someone have any idea how to only keep the actions working on the current item ?

 

 

 

Thanks a lot for your time !!

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Kadd When you want to implement such a functionality, the state of each record must be maintained within the record itself. In your case you are having one variable that controls this. That's why they are open. I hope you have a collection as the data source for the gallery. In that collection you must have all the fields for each record, along with variables to hold the state and actions for each one of item. I've done something similar before. If you need more help, please let me know. Then of course, I'll more details of what you are doing and how. 

  • Kadd Profile Picture
    447 on at

    Hello @CNT ,

     

    Thanks a lot for your reply.

     

    Oh la la... Yes, If you don't mind, I might need some more help then 😛

    I have no collection. I use my SharePoint list as a data source.

    So I have to create a collection out of my data source (i'm not mastering collections at all 😄 ) and add an additional field to that collection. This field will hold the "status" of the buttons ...no in fact i need 6 additional fields (1 for the elipsis, 1 for the lable and 4 for the icons in the label...)

     

    Hmm...

     

    Ok, if you can help a little bit ... 😛

     

    Thnanks a lot !

     

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Kadd You could do it in 2 ways,

    1. Have options for each item in the gallery (where you'll need collections) or

    2. You have have one set of common buttons outside the gallery. This way you can avoid Collections. You have to find the Gallery.Selected item and do the cancel, edit, save or remove operation on that item. It all depends on what kind of user experience you want to have.

  • Verified answer
    Kadd Profile Picture
    447 on at

    Hi @CNT ,

     

    Option 2, I already did it and it works but wanted to try to do something nicer and more user friendly so the user only actions one a single item instead of locking / unlocking / editing / saving all the items of the gallery

     

    For Option 1, That means I have to create, in my collection, 1 field per icon in my menu (Cancel,Edit, Save, Remove) , right ?

     

    in the meantime, I found a way to open the popup menu by item.

    In my elipsis, Onselect=UdapteContext({varMenu:ThisItem.ID})

    In my menu (label), Visible=If(ThisItem.ID=varMenu, true, false)

    In my Cancel button, OnSelect=UpdateContext({varMenu:0})

     

    This opens the menu, and when i click the Cancel button, it closes it.... separately for each item...which is exactly what i need.

     

    but then, my problem is... I don't understand how to set the display mode to Edit for the current item, the cancel for the current item, save for the current item... 

     

    I tried using the same method as above but it doesn't seem to be working.

     

    Would you have any idea about this ?

     

    Thanks a lot !!

     

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Kadd You can follow the same technique.

    For Edit, in the DisplayMode of one control you could say, If(ThisItem.ID=varMenu, DisplayMode.Edit, DisplayMode.View) and then you can reference the DisplayMode of that control for all the other controls.

    For Save and Delete, you can agin reference varMenu and can use that with UpdateIf and RemoveIf to Save or Delete the selected record.

  • Kadd Profile Picture
    447 on at

    @CNT 

     

    Oh !! ok...this works !! 🙂 It didn't work when i tried cause i didn't put the formula at the right place, thanks !!

     

    Ok now, i'm missing the last thing.... saving the current item only ! ‌‌

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Kadd Glad to help!

     

     

    Please remember to give a 👍 and accept the solution as it will help others in the future.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard