cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (4,441)