Skip to forum content
Mif
— mystic javascript interface
You are not logged in. Please login or register.
Active topics Unanswered topics
Post new reply
Post new reply
Compose and post your new reply
You may use: BBCode Images Smilies
All fields labelled (Required) must be completed before the form is submitted.
Topic review (newest first)
tree.load({
url: '../InitTreeJson.do',
method: 'post',
data: $('domainForm')
});
tree.addEvent('load', function(){
tree.select(myNode);
tree.root.recursive(function(){
if(this.isRoot()) return;
if(this.data.id=='322') {
alert('found my node');
return false;
}
});
});
No sorry, I do not want to expand the tree. I need to find a specific node in the tree.
I load the tree using:
tree.load({
url: '../InitTreeJson.do',
method: 'post',
data: $('domainForm'),
});
And right after that I am trying to find a specific node so I can use:
tree.select(myNode);
tree.root.recursive(function(){
if(this.isRoot()) return;
if(this.data.id=='322') {
alert('found my node');
return false;
}
});
But I get the error message "tree.root is undefined"
And maybe the reason is that the tree has not been completely loaded?
(It does an ajax request to load the tree from the server)
If I am right, then how can I wait until the tree has been completely
loaded?
from http://mifjs.net/forum/viewtopic.php?id=24
moro wrote:If u want expand tree with forest=true try:
.addEvent('onLoad', function(){
this.root.recursive(function(){
if(this.isRoot()) return;
this.toggle();
});
})
u get error message: '"tree.root is undefined" , when use this code?
First of all: Thanks for this really nice tree control. Good work !
What I am trying to figure out is:
How can iterate over all nodes of the tree (in forest mode) searching for an id that I have put in the data area of the nodes and then select my node?
I found on this forum how to iterate over the tree nodes here: http://mifjs.net/forum/viewtopic.php?id=24
But I get the error message: '"tree.root is undefined"
I guess this might be because I am trying to iterate over the tree right after the tree.load function call.
Does the tree's "load" function load the tree asynchronously? Maybe the tree is not there resp. not completley loaded when I try to iterate over the nodes?
But then, how can I avoid this? How do I know when the tree has been loaded completely? Is there some Event for this?