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

TabIndex, Galleries, and UpdateIf in OnChange

I've got a gallery with a collection as a datasource, acting as a shopping cart for users, users pick products from a list the collection adds them to the "shopping cart" (gallery). I have inputs in the gallery to update Price and Quantity.

Problem: The inputs update the record in the collection using UpdateIf in the OnChange event handler this causes the focus to reset to the first TabIndex in the Gallery returning the cursor back to the top making the user lose their place. Is there any sane way to fix this?

I thought about updating each Item when the user submits the cart but ForAll and Patch dont really cleaningly work in this use case.

I can already hear the whinning from my users...

LMK if any more info is required to help me find a solution, I'm very eager to find something that will give me a clean "shopping cart experience"

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: TabIndex, Galleries, and UpdateIf in OnChange

Hi @DroningOn ,

Could you please share a bit more about your scenario?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. As an alternative solution, you could add a "Save" icon within your Gallery, when you made some changes to your Gallery Items, click the corresponding "Save" icon to save your changes:1.JPG

Set the OnSelect property of the "Save" icon to following formula:

Patch(
RecordsCollection,
ThisItem,
{
Price: Value(TextInput1.Text),
Status: ComboBox1.SelectedItems
}
)

On your side, you may type the following:

Patch(
ShopCartCollection,
ThisItem,
{
Price: Value(PriceTextInputBox.Text),
Quantity: Value(QuantityTextInputBox.Text)
}
)

Please consider take a try with above solution, check if the issue is solved.

 

If the issue still exists, I think a Timer control may help in your scenario. Please consider add a Timer control in your app, set the Duration proeprty to following:

1000

Set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

ForAll(
          RenameColumns(Gallery1.AllItems, "ProductID", "ProductID1"),
          Patch(
                     'YourShopCartCollection',
                      LookUp('YourShopCartCollection', ProductID = ProductID1),
                      {
                         Price: Value(PriceTextInputBox.Text),
                         Quantity: Value(QuantityTextInputBox.Text)
                      }
          )
)

Set the Visible property of the Timer control to following:

false      /* <-- Hidden the Timer control */

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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
Community Support Team
Community Support Team

Re: TabIndex, Galleries, and UpdateIf in OnChange

Hi @DroningOn ,

Could you please share a bit more about your scenario?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. As an alternative solution, you could add a "Save" icon within your Gallery, when you made some changes to your Gallery Items, click the corresponding "Save" icon to save your changes:1.JPG

Set the OnSelect property of the "Save" icon to following formula:

Patch(
RecordsCollection,
ThisItem,
{
Price: Value(TextInput1.Text),
Status: ComboBox1.SelectedItems
}
)

On your side, you may type the following:

Patch(
ShopCartCollection,
ThisItem,
{
Price: Value(PriceTextInputBox.Text),
Quantity: Value(QuantityTextInputBox.Text)
}
)

Please consider take a try with above solution, check if the issue is solved.

 

If the issue still exists, I think a Timer control may help in your scenario. Please consider add a Timer control in your app, set the Duration proeprty to following:

1000

Set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

ForAll(
          RenameColumns(Gallery1.AllItems, "ProductID", "ProductID1"),
          Patch(
                     'YourShopCartCollection',
                      LookUp('YourShopCartCollection', ProductID = ProductID1),
                      {
                         Price: Value(PriceTextInputBox.Text),
                         Quantity: Value(QuantityTextInputBox.Text)
                      }
          )
)

Set the Visible property of the Timer control to following:

false      /* <-- Hidden the Timer control */

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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
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: 185 members 4,525 guests
Please welcome our newest community members: