javascript - Titanium Alloy - unable to disable Label inside Tabbedbar using id -


i have tabbedbar contains labels , inside have label enable property need change in .js file through coding. have tried setting id of particular label , have used. $.lblprof.enabled = false; in .js file. throwing error:

undefined not object(evaluating '$.lblprof.enabled = false')

demo.xml

<tabbedbar id="tabbedbar" platform="ios" backgroundcolor="#369" top="44dp" height="30dp" width="300" index="0" onclick="tabbarclick">    <labels>        <label>details</label>       <label>photos</label>       <label>documents</label>       <label id="tabprofile">profile</label>                            </labels> </tabbedbar> 

demo.js

$.tabprofile.enabled = true; 

if trying disable directly i.e

<label id="lblprof" enabled="false"> 

its working fine.

as @visola mentioned, labels need id in order access them programmatically. otherwise, alloy gives them auto-generated id unhelpful humans.

xml

<tabbedbar id="tabbedbar" platform="ios" backgroundcolor="#369" top="44dp" height="30dp" width="300" index="0" onclick="tabbarclick">    <labels id='labelslist'>        <label id='details'>details</label>       <label id='photos'>photos</label>       <label id='documents'>documents</label>       <label id='tabprofile'>profile</label>                            </labels> </tabbedbar> 

as tabprofile assignment, $ top-level object on page hierarchy. so, $.tabprofile not exist. that's why changing has no effect. need drill down further page $.tabbedbar.labels.label. said, label has no enabled property. so, app throws undefined error.

i review titanium.ui.ios.tabbedbar documentation more examples. appears you'll need simulate disabling them changing color, light gray example, , setting touchenabled false.

hope helps move forward.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -