cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Keep Focus on Item after Patch Formula

I have an app that is connected to a sharepoint list as a data source. One of my columns is called a other which is a number field,

In my app on the edit view for other I have a plus button that increments the value by 1, which is a patch function inserted below.

 

 

Patch(Mending_List, ThisItem,{'Other':ThisItem.Other+1})

 

 

 

This works fine but when they click the button it moves the view to the top of the form and they have to scroll back down to get to this field again.

 

I tried:

 

 

Patch(Mending_List, ThisItem,{'Other':ThisItem.Other+1});SetFocus(DataCardValue24)

 

 

Which didn't work and my google skills are failing me, So if anyone could help me out and offer a solution that would be appreciated

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Anonymous ,

Could you describe more clearly about what control that you use in this example?

I assume that you use an edit form to edit other column, the plus button is inside the form.

After you click this button, the form's view will jump to the top of the form.

If so, I've made a similar test and met the same problem.

After you act this action, the form will jump to the top of the form by default.

I know you want to use setfocus function to avoid this, however, please note that this function's limit:

You cannot set the focus to controls that are within a Gallery control, Edit form control, or Component. SetFocus can be used with a control in a scrollbale screen.

Here's a doc about this control's limit for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-setfocus

So I'm afraid there's no very good way to avoid this currently.

 

As an alternative way, I could give you two advice:

1)put this plus button outside the edit form

Then the button's action will not effect the form's view.

However, in this way, you need to change the formula that you used. Try this:

Patch(Mending_List, Gallery1.Selected,{'Other':Gallery1.Selected.Other+1})

1218.PNG

 

2)use gallery to update order field, put the plus button inside the gallery

The button's action inside gallery will not affect the gallery's view.

12181.PNG

 

 

 

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.

View solution in original post

1 REPLY 1
v-yutliu-msft
Community Support
Community Support

Hi @Anonymous ,

Could you describe more clearly about what control that you use in this example?

I assume that you use an edit form to edit other column, the plus button is inside the form.

After you click this button, the form's view will jump to the top of the form.

If so, I've made a similar test and met the same problem.

After you act this action, the form will jump to the top of the form by default.

I know you want to use setfocus function to avoid this, however, please note that this function's limit:

You cannot set the focus to controls that are within a Gallery control, Edit form control, or Component. SetFocus can be used with a control in a scrollbale screen.

Here's a doc about this control's limit for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-setfocus

So I'm afraid there's no very good way to avoid this currently.

 

As an alternative way, I could give you two advice:

1)put this plus button outside the edit form

Then the button's action will not effect the form's view.

However, in this way, you need to change the formula that you used. Try this:

Patch(Mending_List, Gallery1.Selected,{'Other':Gallery1.Selected.Other+1})

1218.PNG

 

2)use gallery to update order field, put the plus button inside the gallery

The button's action inside gallery will not affect the gallery's view.

12181.PNG

 

 

 

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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,949)