Requirements
|
RadControls
|
Q3 2010 SP1
|
.NET
|
3.5
|
Visual Studio
|
2010
|
programming language
|
JavaScript (only client coding)
|
browser support
|
all browsers supported by RadControls
|
PROJECT DESCRIPTION
This project illustrates how to use the recently added to the Public API of RadTreeView's client object, method addNodesTo.
The method resides in the client-side object representation of RadTreeView and accepts 2 parameters:
- target - instance of the RadTreeView or a RadTreeNode (already added to a tree);
- nodes - array of RadTreeNodes or a RadTreeNodeCollection object (from the same or from different TreeView instance);
This method's main purpose is to batch the inserting of big amount of nodes to a certain NodeCollection, as well as it is the first way of batched transferring of already created nodes from one NodeCollection to another. And on top of all that, addNodesTo introduces the ability of batched cross-instance transferring of nodes (between different TreeViews).
Before going into detail about the project, I would like to emphasize on the non-supported cases of usage of this method:
- You can not mix the adding of new and the transferring of already created nodes;
- You can not pass an array or NodeCollection with nodes from different TreeView instances;
- You can not transfer/(add new) hierarchies of already created (already included in a TreeView) nodes - only flat hierarchy is supported - single NodeCollection or array of RadTreeNodes where the nodes doesn't have any children. (We will implement this in future.)
Lets move on to the project.
What this sample demonstrates is the basic usage of the addNodesTo method.
As you can see, when you load the Default.aspx page into the browser, there are 2 TreeView instances and several buttons at the bottom.
I will try to guide you through the entire functionality this project has to demonstrate with a simple step-by-step procedure:
- Load the page in the browser;
- Click the "Add 10 Nodes to TreeView1" button (nodes should be added to the first TreeView);
- Click the "Add 10 Nodes to TreeView2" button (nodes should be added to the second TreeView);
- RightClick one of the nodes in the first TreeView (a menu with 3 options should appear):
- Click the "Add 10 nodes" option (nodes should be added to the initially rightclicked node).
- Repeat 4. for the second TreeView;
- Select the node that you just have populated with 10 nodes using the menu in the first TreeView;
- Select a node without children in the second TreeView;
- Click the "Move Nodes From Selected Node In TreeView1 To Selected Node In TreeView2" button (nodes should be instantly transferred);
- Select the node that you just have populated in the second TreeView (8.);
- Select a node without any children in the first TreeView;
- Click the "Move Nodes From Selected Node In TreeView2 To Selected Node In TreeView1" button (nodes should be instantly transferred).
This basically covers the scenarios this project should present which are most of the supported by addNodesTo.
The project contains a single page with no code-behind. All the event handlers are separated from the "main functions". The code is pretty straight-forward, so just a small amount of comments are included.
We hope, you will enjoy this feature!