open=true not working when ajax loading

21 views
Skip to first unread message

simbro

unread,
Mar 30, 2011, 10:41:03 AM3/30/11
to mootree
Hi there,

I'm having a problem with mootree, whereby if I expand a node, and it
loads the contents via ajax, the child nodes of that node aren't
expanded, even when I have open="true" in the nodes attribute list.
I've checked the xml and it's fine, and there are no error messages.

Thanks in advance for your help.

Simbro.

simbro

unread,
Mar 31, 2011, 5:00:59 AM3/31/11
to mootree
Hi, I managed to figure out where I was going wrong:

A node cannot have an 'open' attribute with a value of 'true', if it
also has the 'load' attribute set. If the code detects the 'load'
attribute, it automatically sets 'open' attribute to 'false' :


if (node.data.load) {
node.open = false; // can't have a dynamically loading node that's
already open!
node.insert(this.control.loader);
node.onExpand = function(state) {
this.load(this.data.load);
this.onExpand = new Function();
}
}


Hope this helps someone.

Simbro.

mindplay.dk

unread,
Mar 31, 2011, 8:07:46 AM3/31/11
to mootree
since those two attributes actually form a tristate of allowed values,
perhaps it would have been more correct to have just one 'open'
attribute with possible values of 'true', 'false' or 'load'.

I'm glad you sorted it out - I haven't used or maintained this
component in probably five years, and it's been just as long since I
switched from moo to jQ.

The good news is, in the course of it's lifetime, I have had very few
valid bug-reports on this component - it seems to be pretty
reliable :-)

- Rasmus
Reply all
Reply to author
Forward
0 new messages