
Hello how are you? I would like to use the (+) and (-) icons to increment the value inside my text box, the user also has the possibility to manually change it by typing the number.
I managed to do the logic on the outside putting a variable in the Default property of the text box and in the icons I just added or subtracted 1.
But when using inside the gallery all items when I click on the icons are changed and not just the "ThisItem".
What would the logic look like in this case in a gallery?
Thanks and any help will be greatly appreciated.
Rather than using a variable, you'll need to Patch the Quantity to the datasource that is used by your gallery. Something like this
// for + icon
Patch( yourDataSource, ThisItem, {Quantity: Quantity + 1} )
// for - icon
Patch( yourDataSource, ThisItem, {Quantity: Quantity - 1} )
// for OnChange of Text box
Patch( yourDataSource, ThisItem, {Quantity: Value(TextInput1.Text) } )