So, I have a Gallery showing a local Collection, where one of the fields is essentially a choice column. I have added a Dropdown Control into the Gallery Template, and have bound it to the appropriate column in the collection. I am using the "onChange" event of the Dropdown to Patch the record in the Local collection. (I already solved the issue with the dropDown.onChange event being fired every time the gallery is loaded, by setting a variable in the onSelect event - a trick I found on this forum somewhere)
Gallery.Items = local_Questions
Dropdown1.Items=["Yes","No"]
Dropdown1.Default=ThisItem.Answer
Dropdown1.onSelect = Set(dropdownChanged,true)
Dropdown1.onChange =
if(dropdownChanged,
Patch(local_Questions,ThisItem,{Answer: Dropdown1.SelectedText}); Set(dropdownChanged,false)
,false)
This seems to work great about 80% of the time.
Unfortunately, about 20% of the time, there is a BUG where after selecting an answer in the Dropdown box, the control actually just clears and shows an emtpy value, and does not remember the Selection. Sometimes, it even clears the selected values from some of the other dropdowns in the gallery.
I can confirm that the onSelect and onChange events are firing correctly, but I can't figure out why it sometimes does NOT actually remember the User's selection.
I have also tried putting the "Patch" commanc into an external function (in a Timer) rather than patching directly from the onChange event of the control, as I thought that perhaps the onChange event is firing before the new selection has actually been registered, but this had no effect, and the random "clearing" of the drop-down still occurs.
Note, this happens in ALL browsers (Chrome, Firefox, IE and Edge). Interestingly, it does NOT occur in the Windows 10 PowerApps Desktop App (but as that desktop App is painfully slow at even clicking a button, it's not really a viable option for our Users). Also, the bug does NOT occur within the PowerApps studio - only once the app is saved, published, and run in a browser.
Does anyone have any bright ideas of why the dropdown control sometimes misbehaves?
And more importantly, what can I do to mitigate this anoying eroneous behaviour?
James.