How to set default option with UI.OptionDialog?
Is there a way to set the selected option when an option dialog is opened? Without it, option dialogs are very confusing for the user. It's a behaviour that can be seen in a lot of native Android apps, at least.
var dialog = Titanium.UI.createOptionDialog({
options:['Option 1', 'Option 2', 'Option 3'],
destructive:2,
cancel:1,
title:'I am a title'
});
Also, would someone explain what the "destructive" property for OptionDialog does? It's not very clear from the api docs how it differs from the cancel property.
Thanks in advance
Hal
3 Answers
-
Accepted Answer
It's been raised here for a future release.
-
What do you mean by setting the selected option? If you mean getting the option the user selects you need to add an event listener to capture that.
The 'destructive' property sets the button as red, commonly found on buttons with titles like 'delete' or 'remove'.
-
I want to do the same thing, to set the default already picked OptionDialog item index. According to the documents and KitchenSink, it's not there, but in the next version, they really should add a simple default property so we can set default:currentOption,
because it makes sense with Radio Buttons to have the current one already ticked. I'd love to see a solution in the next release, and I think other detail oriented developers would agree.