Where should we put serialize()

We have suffered some problem when I serialize the grid to XML.





mygrid = new dhtmlXGridObject(‘gridbox’);

    

    

    mygrid.setSkin(“modern”);

    mygrid.setImagePath(“imgs/”);

    mygrid.setHeader("<%=session(“registerfieldlist”)%>");

    mygrid.setInitWidths("<%=session(“cwlist”)%>")

    mygrid.setColAlign(“left,left,left,left,left,left,left,left,left,left”)

    mygrid.setColTypes(“link,txt,txt,txt,txt,calendar,txt,txt,txt,txt”);

    mygrid.setColSorting(“str,str,str,str,str,str,str,str,str,str”)

    mygrid.enableLightMouseNavigation(true);

    mygrid.setOnEditCellHandler(doOnCellEdit);

    

        

    function doOnCellEdit(stage,rowId,cellInd){

        if(stage==0){

            alert(“User starting cell editing: row id is”+rowId+", cell index is "+cellInd)

        }else if(stage==1){

            alert(“Cell editor opened”);

        }else if(stage==2){

            

var myXmlStr = mygrid.serialize();

    myXmlStr.setSerializationLevel(false,false,false,false,true)

mygrid.loadXML(“xml/xmlgrid.xml”);



                    }

        return true;

    }

    

mygrid.init();

    mygrid.loadXML(“xml/xmlgrid.xml”);

    

    



We want to do the serialize inside setOnEditCellHandler(stage==2), but mygrid which is the object of the new grid can not be identified inside this function. Should we put serialize function outside?



Many thanks



Chuan Shen