Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created October 16, 2011 07:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronksaunders/1290638 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1290638 to your computer and use it in GitHub Desktop.
Simple function to find child objects
/**
* 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