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

After SubmitForm Gallery.Selected jumps to a new record when gallery is filtered.

When I edit a field on an edit form and then save the record using the Submitform command the record that I am changing(Gallery.Selected) changes in the edit form to the top most record in the gallery. This only occurs if I have filtered the gallery. If there is no filter the record stays on the selected record. Any ideas on how to resolve this?

4 REPLIES 4
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: After SubmitForm Gallery.Selected jumps to a new record when gallery is filtered.

When an update is made to the item, the data source is refreshed, and it's possible that the selection will be lost (some data sources can preserve the selection, others cannot).

 

One way to minimize this problem is to decouple the form item from the gallery selection. This way when you submit the changes in the edit form, the item displayed in the form will not depend on the gallery selection (which may have changed).

 

The blog post at https://blogs.msdn.microsoft.com/carlosfigueira/2017/10/04/decouplingbrowsegalleryfromforms/ shows the steps that you can take to do this.

dtowsey
Level: Powered On

Re: After SubmitForm Gallery.Selected jumps to a new record when gallery is filtered.

Thanks You. THis works for the most part. When I save the editform the changes are not shown in the display form. Not sure what I am doing wrong. I used your code exactly as you describe in your blog.

 

Power Apps Staff CarlosFigueira
Power Apps Staff

Re: After SubmitForm Gallery.Selected jumps to a new record when gallery is filtered.

You need to update the OnSuccess property of the edit form so that when a successful form submission happens, then you navigate to the details screen passing the modified item (EditForm1.LastSubmit) using the same name as the variable passed from the browse screen.

dtowsey
Level: Powered On

Re: After SubmitForm Gallery.Selected jumps to a new record when gallery is filtered.

This is what I included in the onsuccess action of the edit scren.

 

Navigate(LNAPL_Information, ScreenTransition.None, {displayitem:EditForm_4.LastSubmit})

 

The only difference is that I did not pass the displayitem directly to a display form but rather it is passed to the contol holding the information. Maybe this is where it is failing.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

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

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,701)