views:

63

answers:

1

In this component http://wwwendt.de/tech/dynatree/index.html

under 5.4 Loading child nodes on demand ('lazy loading')

it seems that the only way to load the tree nodes in a lazy manner is to grab them from web service. What if I want to grab the nodes from a data structure?

such as:

onLazyRead: function(dtnode){

                dtnode.appendAjax({
                   //url: "sample-data2.json" 
                   //grab the nodes here from array
                });
  }

Any advice? Another question: when onLazyRead is executed, does the whole tree get re-rendered again?

A: 

You could use

dtnode.addChild(dict);

instead of

.appendAjax(...)

In either case, only the changed nodes should get rendered.

dict must be formatted like the JSON response. You can als generate dict from a given tree or node using the toDict() method.

mar10
oh, so anytime the addChild gets invoked, only the added nodes get re-rendered? My understanding was to use addChild cautiously because the entire tree gets re-rendered. I am optimizing the tree without having to go to the server every time the node gets expanded, hence the unsual questions.
gnomixa