Hi guys,
anyone using Mootree2 out there?
I'd like to use it for my project (based on MooTools 1.2b2), and it's
running quite nice, except of one problem I can't figure out:
My tree is dynamically generated, e.g., when the user logs in to the
system, the JS framework sends a question to the backend, and gets a
new XML layout which is used to update the tree.
That's okay, BUT: The new tree is generated below the old one, instead
of replacing it...
When I reload the entire page with the browser's reload button, the
menutree is okay, and the orphant nodes disappear.
Obviously, that's not a nice behaviour, so I'm thinking of a way to
tell MooTree to replace the tree, instead of just adding the nodes to
the old one.
The tree is initialized in the window.load event, so here's my code to
load the tree:
window.addEvent('load', function() {
var menutree = new MooTreeControl({
div: 'navigation',
mode: 'files',
grid: true,
theme: 'mootree2/mootree.gif',
// some other stuff, e.g. select handler etc.
},{
text: 'Menu',
open: true
});
menutree.root.clear();
menutree.root.load('functions/loadmenu.php?action=loadtree');
}
In the login procedure (written in PHP) I send the following back to
the frontend to reload the tree:
print "<script type=\"text/javascript\">";
print "window.fireEvent('load');";
print "</script>";
I'm quite sure I'm missing something stupid, or sending the wrong
event, but I just can't figure it out.
Any clues??
Thanks in advance,
Harald