Tree Serialization problem

Hi,



I have problem during serialization of tree when there is more than one level of hierarchy in the tree.



Below in my code (restoreBlock): I am using 2 dhtmlxtrees: undotree and tree.



In the restoreBlock() , i get rid of the selected node from undotree, insert a new node in tree and save the tree.



when i call the xmlhttprequestSave(): than it fails during the serialization of the tree. It fails only when there is more than one level of hierarchy in the tree.



Situations in which serialization doesnt fail:



1. level of hierarchy in the tree: 1

2. even though the tree has more than 1 level of hierarchy, it doesnt fail the first time but after that it fails all the time.



In certain situations deleting a node returns this error:



deleteselectednode: [Exception… “Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMSerializer.serializeToString]” nsresult: “0x80004003 (NS_ERROR_INVALID_POINTER)” location: “JS frame :: localhost:8080/scholion/design2/dhtmlxtree_xw.js :: anonymous :: line 9” data: no]







Could it be a bug in the serialization tree? Any suggestion is highly appreciated



TC :slight_smile:





--------------------------------------------------- code ------------------------------------------------------



function restoreBlock()

    {

        var selectitem = undotree.getSelectedItemId();

        var currentitemcount = itemcount;

        

            undotree.deleteItem(selectitem,true);

            tree.insertNewItem(-1,currentitemcount,“new title”,0,0,0,0,‘SELECT’);            

         …

            xmlhttprequestSave();

            …

        }        

    }







function xmlhttprequestSave()

    {

        //tree.stopEdit();

     var myXmlStr = tree.serializeTree();    

    





        xmlhttp.open(“POST”, saveLUTreeURL ,true);

        xmlhttp.onreadystatechange=function() {

                if (xmlhttp.readyState==4) { }

             }

        xmlhttp.setRequestHeader(“Content-Type”, “text/xml”);

        xmlhttp.send(myXmlStr);

    }


If you are using not latest build of dhtmlxtree  - the problem may be caused by already fixed bug in serialization ( which occurs only in FF , in case of serialization not expanded nodes in smartXMLParsing mode)
Please contact us directly at support@dhtmlx.com and provide you ref. number - we will send you updated js file.