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

Selecting Position in Browse Gallery

We have an App that lists many (approx 50-100) construction properties in a Browse Gallery. The user scrolls down this list, selects and edits a property and returns to the Browse Gallery to select another.   The problem is that when the user returns to the Browse Gallery, it intermittently repositions its-self on the first item in the gallery. Again, this is an intermittant problem. It often causes the users to have to scroll a long way back down to where they previously were in the Gallery. The users are very unhappy with this issue.

Please suggest a solution for positioning in the browse gallery on a specific record when the user goes back to the gallery. Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
TimRohr
Level 10

Re: Selecting Position in Browse Gallery

Here's a solution while we wait for the behavior to be added to the control...

 

Capture the unique identifier of the record in the Gallery. Let's call it ID. In the OnSelect event of the Gallery, write it to a ContextVariable before any other commands:

UpdateContext({myGalPos: ThisItem.ID})

Doing it as a Context Variable means you can pass the value into the screen if you are returning to the screen after having gone to another (for instance, a Detail screen).

 

Next, have the Default property of the Gallery set to the record that bears that unique piece of data:

First(Filter(myDataSource, ID = myGalPos))

Now, whenever you need to reposition on the record, you can call a Reset() on the Gallery and it will locate on that record, scrolling to it as necessary.

 

View solution in original post

7 REPLIES 7
Community Support Team
Community Support Team

Re: Selecting Position in Browse Gallery

Hi @CJC,

 

Thanks for the feedback.

I think this is the default bahavior of the Gallery control.

For a workaround, please consider enable the following property:

 

NavigationStep – How far a gallery scrolls if its ShowNavigation property is set to true and the user selects a navigation arrow at either end of that gallery.

ShowNavigation – Whether an arrow appears at each end of a gallery so that a user can scroll through the items in the gallery by clicking or tapping an arrow.

 

Or 

ShowScrollbar – Whether a scrollbar appears when the user hovers over a gallery.

 

Reference

 

If you would like to have a property to be available to ReSet Gallery selection or the order, then please consider rise it as an idea:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Regards,

Michael

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

Re: Selecting Position in Browse Gallery

Hello Michael -

 

Thank-you for responding. 

 

Unfortunately, enabling ShowScrollbarShowNavigation or adjusting NavigationStep did not correct the issue and enable me to control the position of the cursor (record position)  in the BrowseGallery upon return to it after editing a specific record. It still defaults to the top of the list.

 

I have also tried setting the Default property, using First or Last functions with Filters, without success.

 

I gather that a gallery Reset function you mentioned, that is not currently available but might be in the future, might provide a solution.

 

In development I have found setting position on a long list to be a very common client requirement.

 

Thank-you

CJC

Community Support Team
Community Support Team

Re: Selecting Position in Browse Gallery

Thanks for sharing the opinion, I will collect this as a feature request.

 

If you have any further questions, please post back.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
TimRohr
Level 10

Re: Selecting Position in Browse Gallery

Here's a solution while we wait for the behavior to be added to the control...

 

Capture the unique identifier of the record in the Gallery. Let's call it ID. In the OnSelect event of the Gallery, write it to a ContextVariable before any other commands:

UpdateContext({myGalPos: ThisItem.ID})

Doing it as a Context Variable means you can pass the value into the screen if you are returning to the screen after having gone to another (for instance, a Detail screen).

 

Next, have the Default property of the Gallery set to the record that bears that unique piece of data:

First(Filter(myDataSource, ID = myGalPos))

Now, whenever you need to reposition on the record, you can call a Reset() on the Gallery and it will locate on that record, scrolling to it as necessary.

 

View solution in original post

jbirkenhead
Level: Powered On

Re: Selecting Position in Browse Gallery

Hi,

 

I kind of understand what you are trying to say on this, would you have some screenshots at all to show what you've done?

 

I have an issue where I have a list of items in screen one, where you can click into screen two to view/amend data for the item selected in screen one. However as son as a data field is amended, the position of the highlighted item in screen one moves to the top of the screen while the user is still in screen two. The user sees the details changing in screen two and it appears to them that they have saved data against the wrong item in screen one.

 

I think what you have suggested may be a fix I could use but can't quite get my head around it.

 

Appreciate any help you can throw my way on this.

 

Thanks.

 

Jason.

TimRohr
Level 10

Re: Selecting Position in Browse Gallery

Hi, @jbirkenhead...

 

I can't find the initial project where I had to use this workaround, but I have mocked something up that hopefully has the important points.

 

Imagine a gallery of employees drawing from a datasource 'HR Employees'...

employeelist.PNG

Each one links out to, in this case, a Detail screen, and from there to an Edit screen... but your screens could be different. What is important is how/where you put your code to make sure you find your way back to the proper item in the gallery when  you return to this screen.

 

Here is the OnSelect property of the gallery:

galleryonselect.PNG

This says to first get the unique field identifying the record (in this case, 'HR Employee') and put it in a context variable, then navigate to the other screen.

 

(Note: I am passing the same context variable to the destination screen because there are various ways to get to the Employee Detail screen, and each path will potentially provide a different Employee... therefore I can't just point the form on the destination screen to be Employee_BrowseGallery.Selected, because that represents only one path. Instead, I have every path provide the EmployeeID context variable, and my one Employee Detail screen can serve all of the various Galleries/paths that could get the user to that screen.)

 

Before you leave the gallery, though, set the Default property using that same context variable you just created...

gallerydefault.PNG

This formula uses Filter() to get the set of records from the 'HR Employees' datasource where 'HR Employee' matches the EmployeeID variable. That will only be one record, but the result of the Filter() statement is a table, so we wrap that in a First() statement to return the first record.

 

On my edit screen...

employeeedit.PNG

...I put the following code in the checkmark's "OnSelect" property:

submitemployeeedits.PNG

Then, when I get back to the original screen, I use the OnVisible property to check the value of that variable. If it is true, I perform a Reset() on the Gallery:

screenonvisible.PNG

Because I have the Default property set on the Gallery, it should end up keeping the proper entry selected and in the view.

 

Like I said, I think this captures the highlights. Let me know if this helps, or if you need something else clarified.

jbirkenhead
Level: Powered On

Re: Selecting Position in Browse Gallery

Hi Tim,

 

Excellent, thanks very much for your repsonse, much appreciated.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 300 members 5,646 guests
Please welcome our newest community members: