Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Apr 28, 2008 22:36
open dhtmlx forum
JS Error while removing the node

Hi ,
when i try to use the below line to remove the child, it is throwing an error

I want to sort the child nodes in alpha order, but how to remove and append the child nodes - is this a correct solution.

for (var i=1; i<Count; i++){
     nodeName = Nodes[i].getElementsByTagName("span")[0].innerHTML;
     sortArray[i] = nodeName;     
}
sortArray.sort();

for (var i=0; i<=Count; i++){     
itemObject.parentObject.htmlNode.childNodes[0].childNodes[i].removeChild(itemObject.tr);
     }

Node was not found" code: "8

Regards.
Answer posted by Support on Apr 29, 2008 02:21
The tree contains a pretty complex inner structure so using manual HTML operation is not the safe way
In case of item sorting , tree have ready to use solution
    ext/dhtmlxtree_sb.js
    tree.sortTree(id,order,levels)