cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Champion
Community Champion

Re: Edit and save only selected item in Gallery

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

Highlighted
Community Support
Community Support

Re: Edit and save only selected item in Gallery

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

9 REPLIES 9
Highlighted
Community Champion
Community Champion

Re: Edit and save only selected item in Gallery

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

Highlighted
Helper III
Helper III

Re: Edit and save only selected item in Gallery

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!

Highlighted
Community Champion
Community Champion

Re: Edit and save only selected item in Gallery

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
Highlighted
Helper III
Helper III

Re: Edit and save only selected item in Gallery

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

 

 

Highlighted
Community Support
Community Support

Re: Edit and save only selected item in Gallery

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

Highlighted
Community Champion
Community Champion

Re: Edit and save only selected item in Gallery

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.
Highlighted
Helper III
Helper III

Re: Edit and save only selected item in Gallery

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!

Highlighted
Community Support
Community Support

Re: Edit and save only selected item in Gallery

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.

 

Highlighted
Helper III
Helper III

Re: Edit and save only selected item in Gallery

 

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

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,419)