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

Edit and save only selected item in Gallery

Hello,

I have a Gallery "GalleryAssignment" which displayed the information stored in a SharePoint List "Assignment". Inside the Gallery I have manually include Labels, Drop Downs and Date Picker which are connected to the SharePoint list. The user can select an assignment within the Gallery and edit and save the information.

        -The edit button appears by default on every row in the Gallery and when it is selected, a Save button is displayed (it is invisible until the edit button is selected).

       -The information within the Gallery (Labels, Drop Downs and Date Picker) initially is shown as View Mode, and when the edit button is selected, the Display-Mode turn to Edit.

I have not been able to achieve that  only the line item selected to be edited in the Gallery is changed to Edit Mode (DisplayMode. Edit) while the other records still shown as View Mode.

 

Any suggestion is much appreciated!

2 ACCEPTED SOLUTIONS

Accepted Solutions
eka24
Super User III
Super User III

Chris Clark did a good job on patching only edited item whiles others remain view mode. Hope it helps
https://youtu.be/41Mpgn7svLs

View solution in original post

v-siky-msft
Community Support
Community Support

Hi @vsolanon 

 

I made a demo app, please check the following steps.

1. modify the Items property of Gallery, add two columns to store EditMode and ViewMode to each row

 

AddColumns('SP list',"EditMode",DisplayMode.Edit,"ViewMode",DisplayMode.View)

 

2. modify the OnSelect property of Edit button.

 

Set(varEditMode,ThisItem.ID)

 

3. set DisplayMode property of TextInput box, dropdown box, and date picker, when the edit button is clicked, the control turns Edit Model

 

If(varEditMode=ThisItem.ID,ThisItem.EditMode,ThisItem.ViewMode)

 

4. set OnSelect property of Save button: 

Set(varEditMode,-1)

5. set Visible property of Save button, when the edit button is clicked, the save button turn visible

 

If(varEditMode=ThisItem.ID,true,false)

 

6. To the new request, set DisplayMode of Edit button, when one edit button is clicked, set other Edit button to be disabled.

If(ThisItem.ID=varEditMode||varEditMode=-1||varEditMode=Blank(),DisplayMode.Edit,DisplayMode.Disabled)

Result:

GIF_36.gif

Sik

 

                                                                                                                         

View solution in original post

10 REPLIES 10
eka24
Super User III
Super User III

Chris Clark did a good job on patching only edited item whiles others remain view mode. Hope it helps
https://youtu.be/41Mpgn7svLs

View solution in original post

Hi @eka24 thank you for the workaround, it worked as a charm!

 

My only question now will be, how I can make invisible/disable the others Edit buttons from the Gallery when a line record of the Gallery is being edited?

 

I have test the solution and noticed when I select to edit one line item and update the information without saving, and then select another line item to be edited, the information updated in the first line item is still shown, however this will not be saved in the system until the user select the Save button. Want to make the application the more clean possible in order for the user to not get confuse and think the information will be updated all at once.

 

Thank you!

eka24
Super User III
Super User III

Good the first main issue is resolved. Be a little more clearer on the new request.

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution

@eka24 I would like that when the user is editing a selected item in the Gallery, the other Edit Buttons disappear.

 

 

v-siky-msft
Community Support
Community Support

Hi @vsolanon 

 

I made a demo app, please check the following steps.

1. modify the Items property of Gallery, add two columns to store EditMode and ViewMode to each row

 

AddColumns('SP list',"EditMode",DisplayMode.Edit,"ViewMode",DisplayMode.View)

 

2. modify the OnSelect property of Edit button.

 

Set(varEditMode,ThisItem.ID)

 

3. set DisplayMode property of TextInput box, dropdown box, and date picker, when the edit button is clicked, the control turns Edit Model

 

If(varEditMode=ThisItem.ID,ThisItem.EditMode,ThisItem.ViewMode)

 

4. set OnSelect property of Save button: 

Set(varEditMode,-1)

5. set Visible property of Save button, when the edit button is clicked, the save button turn visible

 

If(varEditMode=ThisItem.ID,true,false)

 

6. To the new request, set DisplayMode of Edit button, when one edit button is clicked, set other Edit button to be disabled.

If(ThisItem.ID=varEditMode||varEditMode=-1||varEditMode=Blank(),DisplayMode.Edit,DisplayMode.Disabled)

Result:

GIF_36.gif

Sik

 

                                                                                                                         

View solution in original post

eka24
Super User III
Super User III

If you are to follow strictly Chris approach, then the work around would be giving the selected item background on the gallery, a different color from the others.
Also try changing the UpdateContext from view to disabled an see the effect.
By the way, the other edit is view only.

Hi @v-siky-msft Thank you very much for the information! It worked 🙂

 

Would it be possible when the user select the Edit button of one item in the Gallery, cannot select another item in the gallery if the Edit button is still active?

 

I noticed with the solution proposed, the user cannot Edit the value of the other items in the Gallery, however is able to select them.

I am asking this because I have a second Gallery in the screen and I filter this second Gallery based in the selected item from the first Gallery (Gallery.selected). It is not working as expected, (please see image attached for reference-I have add a label test, and noticed even though the Edit item selected is the first in the Gallery, the yellow label brings the ID for the second item, since the user select it)

PowerApp Question3.JPG

Thank you in advance!

Hi @vsolanon 

 

Yes, I got you.

Please go to set the Selectable property of Gallery as follows, then when one row is being edited, the gallery cannot be selected.

If(varEditMode=-1 || varEditMode=Blank(), true,false)

GIF_37.gif

Hope this helps.

Sik

 

Please click Accept as solution if my post helped you solve your issue.

 

 

@v-siky-msft  Thank you very much!! this was exactly was I was looking for 🙂

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,317)