I created a tree with load on demand enabled with tri-state checkboxes. This is working perfectly.However, when I do a postback, I want to be able to access the child nodes of the parent which I checked (without expanding the parent first!).
For example:
My tree looks like this (with "Parent 1" not expanded)
Then when I check the tri-state checbox @ "Parent 1" and do a postback, the selectedNodes property doesn't contain the child nodes (since they are not loaded).
How can I access those nodes without expanding "Parent 1" first?
Unfortunately this is not possible. The nodes must be populated first, otherwise you can not access them, they just don't exist.
What exactly you're trying to achieve? We may suggest an alternative solution.
My parent is just a sort of container, the real values are in the child nodes. So I need those child nodes, I'm not interrested in the parent node.
Isn't there a way (client side) to recursively populate the child nodes when checking the parent node?
Thanks, for the suggestions, I will try them next week.
On the client side you can populate nodes simply by expanding them:
parentNode.set_expanded(true, true);
Then you can go through the children recursively and expand them as well. However such approach will lead to many callbacks to the server and poor performance. Depending on the amount of data it may be more convinient to just disable load-on-demand.
Do you really need to access the DataTreeNode objects? Maybe you can implement the desired functionality by loading the backend (database) objects and work with them instead of tree nodes.