Created
December 2, 2010 16:07
-
-
Save dmachi/725574 to your computer and use it in GitHub Desktop.
Recursive tree item getter for tree.
This file contains hidden or 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
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