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

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 (8,837)