Search code examples
titaniumtitanium-mobiletitanium-alloy

Getting alloy element id as a variable


In Alloy Titanium, I can access XML elements with their id $.element_id but what if the element_id is a variable in the controller how i can get it. for example, what i want to do is something like this :

var x = 'y';
$.x.open();

where x is an id for element in the view.


Solution

  • In such case you simply have to reference the view in a different way.

    there you go:

    var x = 'y';
    $[x].open();
    

    Let me know when this works-out for you.