Dynamic tree building

Hi, I’m new to this library and have been evaluating it. The only thing I can’t seem to do or figure out (or point me to an example please) is how to build a tree dynamically upon expansion.

I want my tree to have childen nodes (and if those nodes have children, i want the “+”) to be shown,
and when the “+” is clicked, I want to do an Ajax call and build the children’s sub-tree dynamically.

is this possible? is there an example somewhere?

Thanks.

Yes, that is what the Incremental Tree sample represents: Incremental Tree

Unlike the normal case for using a “TreeExpanderButton” where the children already exist and are connected from the parent node, it assumes there is a flag to indicate whether or not it has ever been expanded. If it hasn’t been, then it could ask for what children there are. When a successful response arrives, you could execute a transaction to add the children.

There’s a derivation of that sample at Incremental Tree. It pretends to make a request to a server and then upon a timer event handles a pretend response.

1 Like

perfect! thanks.