Created
October 16, 2011 07:58
-
-
Save aaronksaunders/1290638 to your computer and use it in GitHub Desktop.
Simple function to find child objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* helper to find an element, can be used when there are | |
* multiple elements in a row and you need to find one | |
* | |
* @param _o {Object} parent object to find elements in | |
* @param _i {String} id of the element you are looking for | |
*/ | |
function findElement(_o, _i) { | |
for(var x in _o.children) { | |
if(_o.children[x].id === _i) { | |
return _o.children[x]; | |
} | |
} | |
return ""; | |
} | |
// | |
// SO if you have an element like this in your row | |
var label = Ti.UI.createLabel({ | |
width : 250, | |
height : 35, | |
item_type : "LABEL", // us this to know we clicked a checkbox | |
id : "LABEL_" + i, | |
text : "LABEL_" + i, | |
left : 35, | |
}); | |
// | |
// you can find it like this | |
findElement(rowObject, "LABEL_3"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment