I am trying to add a row at index 0 in a dropdown list so that the user is not required to make a selection. I have tried the following in the propertyChange Event Handler but does not seem to work.
dropdown = event.source.data
newrow = [0, ""]
dropdown = system.dataset.addRow(dropdown, 0, newrow)
You have to assign to event.source.data. However, if you are trying to do this in the property change event, filtering for the ‘data’ property, your assignment will simply trigger another change event. Which will insert an infinite number of such rows. So, you can’t do it that way. You need to include that row in the binding. Commonly done with “Union All”:
Select 0 as key, '' as text
Select ....(Syntax varies somewhat across the different database brands.)
Another option would be to bind your data to a custom dataset property, then look for updates to that property in the change event, where you insert the row and assign to the ‘data’ property.