Dynatree jquery plugin add custom properties to node


I would like to add new properties to DynatreeNode class. For example in methods OnSelect I want to use node.myproperty. node.myproperty value is calculated from some DOM element. Is there a way to do this? I tried using jQuery extend, but it does'nt seem to be possible.

this is JavaScript, so you can create a new attribute virtually everywhere, simply by assigning it ;-)

For Dynatree, the recommended place would be the node.data object, e.g.

node.data.foo = "bar";

then access it:

onSelect(node){
    if(node.data.foo !== undefined){
        alert(node.data.foo);
    }
}