Titanium JIRA Archive
Appcelerator Community (AC)

[AC-858] Unable to address MenuItem from index.js

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNot Our Bug
Resolution Date2015-09-15T04:05:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Studio
Labelsn/a
ReporterMelvin Chia
AssigneeShak Hossain
Created2014-08-21T14:46:45.000+0000
Updated2016-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.

Comments

  1. Harish Mridha 2015-09-08

    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>
       
       function doClick1(e) {
           alert("Menu item clicked: " + e.source.title);
           e.source.setVisible(false);
       }
       $.win.open();
       
       
    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. Thanks

JSON Source