web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / TabIndex, Galleries, a...
Power Apps
Answered

TabIndex, Galleries, and UpdateIf in OnChange

(0) ShareShare
ReportReport
Posted on by 45

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"

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    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,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard