[TIMOB-24813] different sub-variable names for optionDialog
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-08-28T03:36:45.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | ILAY SENER |
Assignee | Vijay Singh |
Created | 2017-05-19T16:04:27.000+0000 |
Updated | 2018-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
[~isener] Can you provide test code to reproduce this issue ? Thanks.
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(); } }
"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; }
[~isener] "index" is available in both platform as mentioned in above comment. Can you verify at your end if its working. Thanks.
it should. Cheers.
This is not an issue. In previous comments, it is explained in detail. So resolving it.
Closing as invalid. If incorrect, please reopen.