Have this WebDataTree:
<ig:WebDataTree ID="itemtree" class="ItemTree" runat="server" DataSourceID="hdsItem" SelectionType="Single" NodeIndent="10" InitialDataBindDepth="1"> <AutoPostBackFlags SelectionChanged="On" /> <DataBindings> <ig:DataTreeNodeBinding DataMember="dsItemCategoryRoot_DefaultView" KeyField="CategoryID" TextField="Description" ValueField="CategoryID" TargetField="Category" /> <ig:DataTreeNodeBinding DataMember="dsItemCategory_DefaultView" KeyField="CategoryID" TextField="Description" ValueField="CategoryID" TargetField="Category" /> <ig:DataTreeNodeBinding DataMember="dsItem_DefaultView" KeyField="InventoryID" TextField="Name" ValueField="InventoryID" TargetField="Inventory" /> </DataBindings> </ig:WebDataTree>...that is bound to a datasource and setup to automatically download nodes on demand, with a InitialBindDepth of 1.It works perfectly, it loads all the root nodes and then loads a set of children when I expand a node.
I also have some code that seeks a certain node in the tree. (code below) It finds the node by key, then sets that as the active node, expands it, and expands all ancestors to that point. The problem is, while it allows me to set that as the active node, the children of that node might not be loaded yet. Is there a way I can continue to have it load on demand, but also manually force it to load the children of a certain node if I need to?
itemtree.ActiveNode = MyNodeitemtree.ActiveNode.Expanded = Trueitemtree.ActiveNode.ExpandAnscestors()itemtree.ActiveNode.Selected = True
In case my request didn't make any sense, here's an example of what I am looking for. Hopefully it is more clear.
I have a tree that looks like this:
.A. A1. A1a. A1b. A1c. A2. A3.B. B1. B2.C.D
The tree is set with InitialDataBindDepth="1" so that only the first level of nodes, A, B, C, D are initially loaded.
What if when the page loads, I want to jump directly to node A1a. I want to make it be the active node, and to have the child nodes of it and all of its ancestors be loaded. Therefore you would see A, B, C, D, A1, A2, A3, and A1a, A1b, A1c
Hi kchitw,
In order to be able to set active node from 3rd level of the tree, which is not initially loaded, you will have to expand all its parents first. This could be done for example in the Initialize client-side event, using code, similar to the following:
var tree;
function itemtree_Initialize(sender, eventArgs) {
tree = sender;
sender.getNodes().getNode(0).set_expanded(true);
sender.getNodes().getNode(0).get_childNode(0).set_expanded(true);
setTimeout("setActiveNode()", 200);
}
function setActiveNode() {
var node = tree.getNodes().getNode(0).get_childNode(0).get_childNode(0);
tree.set_activeNode(node);
If you have any questions, please let me know.