Skip to content

Instantly share code, notes, and snippets.

@dmachi
Created December 2, 2010 16:07
Show Gist options
  • Save dmachi/725574 to your computer and use it in GitHub Desktop.
Save dmachi/725574 to your computer and use it in GitHub Desktop.
Recursive tree item getter for tree.
var getChildren = function(model, item){
children = [];
if (model.mayHaveChildren(item){
var ch = model.getChildren(item);
dojo.forEach(ch, function(child){
children.push(child)
children = children.concat(getChildren(model, child));
});
}
return children;
}
dojo.connect(tree, "onClick", tree, function(item){
return getChildren(this.model, item);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment