Reputation: 849
I would like to auto select the parent after deleting a selected node.
The following is code that I use to delete a node and any children if there is any
var selectedNode = treeview.select();
$(selectedNode).children('.k-group').remove();
treeview.remove(selectedNode);
How would I auto select the parent node after the delete?
Upvotes: 0
Views: 415
Reputation: 16990
Try the folllowing:
var selectedNode = treeview.select();
var parentNode = treeview.parent(selectedNode);
$(selectedNode).children('.k-group').remove(); // you don't actually need this line of code
treeview.remove(selectedNode);
treeview.select(parentNode);
Take a look through the documentation too:
Upvotes: 2