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

How to avoid that first item is selected after navigating back using Sort functionality

Hi,

 

I have added Sort in the formula of my items property of the gallery.

But now when I edit a record and navigate back to my gallery, the first item is selected automatically.

When I remove the Sort from the formula, the edited record is still shown after I navigate back (desired behavior).

Is there a setting I can use for this?

Thx

Kr

 

2 REPLIES 2
Community Support Team
Community Support Team

Re: How to avoid that first item is selected after navigating back using Sort functionality

Hi @ThomasVDS ,

Since you have navigate to gallery screen, how do you find the edit form display the first record?

I'm a little confused about your issue.

Could you show me your screenshoots?

 

What's more, you could try to use 'Modified' field to make sure the edit form display the item that you editted just now.

Try this formula:  (set the edit form's Item)

If(Gallery1.Selected=First(Sort(gallery,......,...)),            
First(SortByColumns(tablename,"Modified",Descending)), //display the item that you editted just now
Gallery1.Selected) //display the selected item

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ThomasVDS
Level: Powered On

Re: How to avoid that first item is selected after navigating back using Sort functionality

@v-yutliu-msftI'll give more explanation.

I have a screen with gallery and form view mode (see print screen).

The 'Items' property of the gallery is: 

SortByColumns(Search('[dbo].[Consultants]',txtSearchConsultant.Text,"ConsultantID","FirstName","LastName"),"ConsultantID",Ascending)

The part in red I have added at a later stage. This is causing the issue I have now.

The 'Item' property of the form view: galConsultants.Selected

When I edit a value of the form in a separate screen (see print screen) and click to submit and navigate back to the first screen. Then the first item of the gallery is now selected and not the one I modified. When I click on the cancel button in the edit screen (ResetForm and Back()), it works fine.

It looks like that the submit function is telling to reselect the gallery.

 

Consultant_sort issue_before.PNGEdit consultant.PNGConsultant_sort issue_after.PNG

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 84 members 4,612 guests
Recent signins:
Please welcome our newest community members: