[AC-858] Unable to address MenuItem from index.js
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Resolved |
| Resolution | Not Our Bug |
| Resolution Date | 2015-09-15T04:05:50.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Alloy, Studio |
| Labels | n/a |
| Reporter | Melvin Chia |
| Assignee | Shak Hossain |
| Created | 2014-08-21T14:46:45.000+0000 |
| Updated | 2016-03-08T07:37:09.000+0000 |
Description
views/index.xml contains:
styles/index.xml contains:
"MenuItem":{
showAsAction:Titanium.Android.SHOW_AS_ACTION_NEVER,
}
"#hidekb":{
showAsAction:Titanium.Android.SHOW_AS_ACTION_ALWAYS,
visible:"false",
}
controllers/index.js contains:
$.hidekb.setVisible(false);
Results: Android phone gives a Uncaught TypeError: Cannot call method 'setVisible' of undefined. Source: $.hidekb.setVisible(false);
This was tested on a Samsung Galaxy Note 2 LTE running Android 4.3. Project is based on the Default Alloy Project template.
Hi , I tested the issue you reported. It looks like the feature "setVisible" in MenuItem on android is working fine for me. This is not a bug in our platform. You need a reference to call the method .
<Alloy> <Window id="win" fullscreen="true"> <Menu id="menu" platform="android"> <MenuItem id="menuItem" title="Item 1"onClick="doClick1" showAsAction="Ti.Android.SHOW_AS_ACTION_IF_ROOM" /> </Menu> </Window> </Alloy>I tested this using the studio build: 4.1.1.201507141126 and TiSDK 4.1.0 GA I will mark this ticket as "resolved" since I can't reproduce it. However, feel free to reopen with additional information if you notice otherwise. Thanksfunction doClick1(e) { alert("Menu item clicked: " + e.source.title); e.source.setVisible(false); } $.win.open();