Hi,
I have noticed that the default value of a textbox nested within a gallery control will have the following behaviour which may be a bug. I have put together the following example to demonstrate the bug.
Step 1. Insert button1, which will populate a collection by setting the OnSelect formula to
>> OnSelect = Collect(Collection1, {Column1Name: “test”})
Step 2. Insert a gallery control and set “Collection1” as the data source.
>> Items = Collection1
Step 3. Insert a textbox into the gallery control. Set the default property of the textbox to the Colum1Name
>> Default = Column1Name
Now each time when you click “Button1” you will see a new row added to the gallery with the “test” string displayed.. as expected.
Step 4. Type a new string into the text box on the first row of the gallery. Now press button 1. Each time you press “button 1” now the default value of the textbox is no longer the Colum1Name value as expected.
Has anyone else experienced this issue or able to offer a work around?
Any Response from the production team? It would be good to get a long term fix for this rather than work arounds.
I apreciate everyones suggestions. All have been very usefull.
The work around I have used is to save the contents of the gallery to Collection1 everytime button 1 is pressed, Making sure the save happens before creating a new row in collection 1.
Hi @AnthonyPhan,
I have made a test and the issue is confirmed on my side.
I would post this issue to my product team, if the issue is solved, I would reply here.
In addition, as an alternative solution, I agree with @PeteMc's thought almost. You could consider take a try to reset your Gallery control before adding a new row into your Gallery.
I have made a test on my side, please take a try with the following workaround:
Set the OnSelect property of the Button control to following formula:
UpdateContext({GalleryItems:Blank()});
Collect(Collection1,{Column1Name:"test"});
UpdateContext({GalleryItems:Collection1})
Set the Items property of the Gallery control to following:
GalleryItems
In addition, if you want to save the modification within your Gallery control, please take a try with the following workaround:
Set the OnSelect property of the Button control to following formula:
UpdateContext({GalleryItems:Blank()});
Collect(Collection1,{Column1Name:"test"});
UpdateContext({GalleryItems:Collection1})
Set the Items property of the Gallery control to following:
GalleryItems
Set the OnChange property of the Text input control within the Gallery control to following formula:
Clear(Collection1);
ForAll(Gallery1.AllItems,Collect(Collection1,{Column1Name:TextInput1.Text}))
Best regards,
Kris
On testing I am having the same issue, a workaround was to reset the gallery at the same time as adding the new item to the collection. I have attached a demo app with this workaround.
The issue with the workaround is that you loose the data you modified at the top, you could have an onChange event on the text box save back to the collection to prevent the data loss.
hi @PeteMc
The underying collection data is still the same. Infact if add an additional label displaying the value it will show correctly
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional