I have created a function to move my treenodes up and down on the client side by creating a new node, copying the old node information to the new node, then removing the old node and inserting the new node into at a index offset by 1. Code:
This all works except after wards, when I try and access the parent of newNode, it says that "get_parent() is null or not an object." I realize that in this function I have the parent object, but this is just a code snippet. Soon after the newNode is created I will need to get it's parent, and it's parent's parent information. This is done in a seperate function that does not have access to the parent object in the above code snippet. Is this a known issue, or is there a fix?
var
newNode = new Telerik.Web.UI.RadTreeNode();
newNode.set_text(node.get_text());
newNode.set_value(node.get_value());
treeView().trackChanges();
var parent = node.get_parent();
var index = parent.get_nodes().indexOf(node);
var newIndex = null;
if(direction == "up")
var newIndex = index - 1;
if(direction == "down")
var newIndex = index + 1;
parent.get_nodes().remove(node);
parent.get_nodes().insert(index,newNode);
treeView().commitChanges();
This all works except after wards, when I try and access the parent of newNode, it says that "get_parent() is null or not an object." I realize that in this function I have the parent object, but this is just a code snippet. Soon after the newNode is created I will need to get it's parent, and it's parent's parent information. This is done in a seperate function that does not have access to the parent object in the above code snippet. Is this a known issue, or is there a fix?