I have a tree structure displaying all my tasks which are fetched from the database.
Now, I am looking to dynamically add a Root node. This means that when a user clicks the 'Add New Root Node' button, a new Root will be created in the Tree view panel.
Currently, I can create children of existing root nodes but not new parents.
In order to add a child to an existing root node, I use the following code:
text: 'Add new Root Node',
iconCls: 'icon-save',
handler: function () {
var task = taskStore.getRootNode().findChild('Name', 'Parent 1');
if(task) {
task.insertChild(0, new taskStore.model({
Name: 'Added as first child!',
PercentDone: 60,
StartDate : new Date(2010, 0, 6),
EndDate : new Date(2010, 0, 8)
})
);
}
}
While this works fine for adding children, what modifications do I need to make in order to successfully add a New Root Node?
Regards, Yogendra Singh