a new feature in only two lines

19 views
Skip to first unread message

httpwe...@gmail.com

unread,
Jul 15, 2009, 11:20:24 PM7/15/09
to mootree
hey Rasmus,

I am at a computer where I don't have SVN installed, so I can't commit
this myself. Would you kindly add this to the source? it's only two
lines.

I'd like to add a new handler called "onLoadComplete". It's necessary
for a project I'm doing. What it does is put a control trigger that is
executed when a node has finished loading its children.

the first line is at Line 102, where I define the new onLoadComplete
function, in the MooTreeControl class:

99 this.onExpand = config.onExpand || new Function(); // called when
any node in the tree is expanded/collapsed
100 this.onSelect = config.onSelect || new Function(); // called when
any node in the tree is selected/deselected
101 this.onClick = config.onClick || new Function(); // called when
any node in the tree is clicked
102 this.onLoadComplete = config.onLoadComplete || new Function(); //
called when any node in the tree finishes loading


the second addition is at line 644, in the MooTreeNode class:

637 _loaded: function(text, xml) {
638 // called on success - import nodes from the root element:
639 this.control.disable();
640 this.clear();
641 this._import(xml.documentElement);
642 this.control.enable();
643 this.loading = false;
644 this.control.onLoadComplete(this); // <<<< *********** this is
the line I added
645 },


I think this new trigger will be useful for everyone - it solved my
problem and was simple to introduce.

Cheers,
Ian
Reply all
Reply to author
Forward
0 new messages