Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2826] iOS optionDialog clickEvent.cancel should be boolean

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-26T22:12:13.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsdocumentation, ios, iphone, optiondialog
ReporterErnesto
AssigneeNeeraj Gupta
Created2011-04-15T03:30:32.000+0000
Updated2012-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....

Comments

  1. Stephen Tramer 2012-07-26

    Updated to be correct in latest available docs (http://docs.appcelerator.com)

JSON Source