[TIMOB-2826] iOS optionDialog clickEvent.cancel should be boolean
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-07-26T22:12:13.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | documentation, ios, iphone, optiondialog |
| Reporter | Ernesto |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T03:30:32.000+0000 |
| Updated | 2012-07-26T22:13:36.000+0000 |
Description
Problem:
According to the docs*, the cancel property of the
optionDialog click event is a "boolean to indicate if
the cancel button was pressed", but it is the index of the button
that was originally passed to the
createOptionDialog.
Example:
// index 4 is the cancel button
var opts = ['a', 'b', 'c', 'd', 'Cancel'];
var dialog = Ti.UI.createOptionDialog({
title: 'Test',
options: opts,
cancel: opts.length -1
});
dialog.addEventListener('click', function(e) {
Ti.API.info(e);
})
When clicking the 'Cancel' option with the above code, the result is:
[INFO] {
cancel = 4;
destructive = "-1";
index = 4;
source = "[object TiUIOptionDialog]";
type = click;
}
Expected result:
[INFO] {
cancel = True;
destructive = "-1";
index = 4;
source = "[object TiUIOptionDialog]";
type = click;
}
So this is either a bug in the click event object construction or the documentation.
I'm using 1.5.1.
[*] http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.OptionDialog-object"> http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI....
Updated to be correct in latest available docs (http://docs.appcelerator.com)