| View previous topic :: View next topic |
| Author |
Message |
fross1
Joined: 10 Aug 2007 Posts: 1
|
Posted: Fri Aug 10, 2007 9:06 pm Post subject: How to add a nodes on the tree view |
|
|
Hello,
I would like to know how can i add a node on the client side.
I see the add method, how use it.
like this :
$('myTree').add(who, who);
1.If i use the add method, the node will be created ?
2.Can I edit the content like the grid ?
Thanks in advance. |
|
| Back to top |
|
 |
jake
Joined: 18 Oct 2007 Posts: 6
|
Posted: Sat Oct 20, 2007 5:44 am Post subject: |
|
|
You must create the node before you add it to the tree.
| Code: |
var tree = nitobi.getComponent('ID of your tree');
var newNode = new nitobi.tree.Node();
newNode.setLabel("my new node");
// Assuming you want to make it a root node:
tree.getChildren().add(newNode);
// Assuming you want to make it the child of the root node's 3rd child:
tree.getChildren().get(0).getChildren().get(2).getChildren().add(newNode);
|
|
|
| Back to top |
|
 |
|