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)
Blah. Here's an easier solution:
var node = tree.getSelected();
var new_node = new Mif.Tree.Node({
parentNode : node,
tree : tree
}, {property: {name: foobar.getTmpName(node),}
});
tree.add(new_node, node, 'inside');
new_node.rename();

LOLz... I noticed that I kept on replying to my own threads. Anyway, I just overrode the add() method:
Mif.Tree.implement({
add: function(node, current, where){
if(!(node instanceof Mif.Tree.Node)){
node=new Mif.Tree.Node({
parentNode: null,
tree: this
}, node);
};
node.inject(current, where, Mif.Tree.Draw.node(node));
this.fireEvent('add', [node, current, where]);
node.rename();
return this;
}
});
I hope this solutions helps other people too! 
Hi,
Is there a way to select a newly added node? I need a way to do this because I wish to automatically call rename() after adding each node.
After reading this thread http://mifjs.net/forum/topic/77/, I figured that perhaps I can do something like tree.select(tree.ids[uid]), but my browser tells me that "tree.ids" has no properties.
Regards,
[ simon.cpu ]