Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24813] different sub-variable names for optionDialog

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2017-08-28T03:36:45.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterILAY SENER
AssigneeVijay Singh
Created2017-05-19T16:04:27.000+0000
Updated2018-08-06T17:37:03.000+0000

Description

I am using a simple optionDialog: when running on iOS, I get the following error: message = "undefined is not an object (evaluating 'e.source.options[e.source.selectedIndex].toString')"; However, this works perfectly fine on Android. It looks like on Android, selectedIndex is available, but when running on iOS, same parameter is named differently, 'index'. attached are the screenshots from debugging for both android and ios. This should be uniform across both platforms.

Attachments

FileDateSize
observeView.js2017-07-31T13:17:32.000+000012399
observeView.tss2017-07-31T13:15:42.000+00001338
Screen Shot 2017-05-20 at 00.01.20.png2017-05-19T16:04:22.000+0000461261
Screen Shot 2017-05-20 at 00.02.47.png2017-05-19T16:04:25.000+0000640044

Comments

  1. Vijay Singh 2017-07-31

    [~isener] Can you provide test code to reproduce this issue ? Thanks.
  2. ILAY SENER 2017-07-31

    Sure. Attached and below should suffice I believe to reproduce the error. observeView.js --------------- function setOccupants(e) { // $.occp.title = (e.source.options[e.source.selectedIndex]).toString(); var selectedItem; if (OS_IOS) { selectedItem = e.index; } else { selectedItem = e.source.selectedIndex; } $.occp.title = selectedItem.toString(); if ((e.source.options[selectedItem]) > 1) { $.classView.show(); $.classView.height = 30; $.classView.top = '5'; } else { $.classView.height = 0; $.classView.hide(); } }
  3. Vijay Singh 2017-08-01

    "index" is available in both platforms as mentioned [here](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.OptionDialog-event-click). It is property of event. "selectedIndex" is available with android only , as mentioned in doc [here](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.OptionDialog-property-selectedIndex). It is property of option dialogue. So you can use in your code var selectedItem = e.index ; rather var selectedItem; if (OS_IOS) { selectedItem = e.index; } else { selectedItem = e.source.selectedIndex; }
  4. Vijay Singh 2017-08-25

    [~isener] "index" is available in both platform as mentioned in above comment. Can you verify at your end if its working. Thanks.
  5. ILAY SENER 2017-08-25

    it should. Cheers.
  6. Vijay Singh 2017-08-28

    This is not an issue. In previous comments, it is explained in detail. So resolving it.
  7. Eric Merriman 2018-08-06

    Closing as invalid. If incorrect, please reopen.

JSON Source