I am using a gallery to capture line items. I would like the OnChange of the text fields to update a collection. The problem is when tabbing or clicking to the next field, the OnChange fires and the field loses focus. This doesn't make for a nice user experience because the user needs to click in the box a second time.
There is a way round this by using ForAll on Gallery.AllItems in my save button to patch the collection. Unfortunately Power Apps doesn't allow me to access the text input values if the text inputs are in layout containers within the gallery (which mine are). I could re-do my gallery without containers but this will be very time consuming and not very flexible if I want to make changes to layout, add new fields etc.
Wondering if anyone has encountered this and know of a solution.
@vermaaman , unfortunately it needs to be inside a gallery as it is for collecting repeating lines of data. Looks like I'll need to ditch the layout containers and use ForAll with Gallery.AllItems to patch the values after they've been entered.
@Wouter_K , There is a workaround that enables you to keep the layout containers in the gallery. You to create a duplicate collection and update this in the OnChange. This gets around the field losing focus on tab but introduces the added complexity of dealing with a duplicate collection.
I ran into this too, and the second Collection workaround seems to be working well. For anybody needing more explicit instructions, see: www.reddit.com/r/PowerApps/comments/uj7k4d/losing_focus_on_item_within_gallery/
I called them a "read" collection (what the gallery displays and what new entries go into) and a "write" collection (which is what I'm updating on gallery changes). Data flows from data source to "read" to "write" back to data source.
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Your chance to join an engaging competition of Power Platform enthusiasts.
The Super User program for 2022 - Season 2 has kicked off!
Attend in person or online, there are incredible conferences and events happening all throughout the month of September.