Topic: Automatically select a node onload /oncomplete
Is there anyway to automatically select a node once the tree has initially loaded?
sorta like:
tree = new Mif.Tree({
......
}).addEvent('onComplete',function(){
this.select(node);
});Or I am currently using expand to to make the node visible to the end user, is there anyway of expanding this so that I can use this to automatically set the node as selected.
options: {
autoSelect: true
}
expandto: {
expandTo: function(node){
if(this.autoSelect == true) {
node.toggleSelected();
}
if (!node) return this;
var path = [];
while( !node.isRoot() && !(this.forest && node.getParent().isRoot()) ){
node=node.getParent();
if(!node) break;
path.unshift(node);
};
path.each(function(el){
el.toggle(true)
});
return this;
},
}I know this code is totally wrong but just trying to get an idea where to start...