Dragging a node from Tree to TreeGrid

Hi,



I am dragging a node from Tree to TreeGrid and it is adding that node as last node to the selected parent in Treegrid. I want to add that dragged node as first child of parent in Treegrid. Is is possbile? If yes, please suggest a way.



Thanks in advance.

There is no simple way to achieve such functionality.
You can use


mygrid.setDragBehavior(“complex”);
mygrid.attachEvent(“onDrag”,function(sid,tid){

mygrid.setDragBehavior(“complex-next”);
mygrid.dragContext=“sibling”;
mygrid.dragContext.alfa=true;

return true;
})



It didnt work for me. So I used alternate way. I created new method to move up the newly added row.



function moveRowOnTop(rowId)



{



    try



    {



        var strParentId = mygrid.getParentId(rowId);


        var arrTemp = mygrid.getAllSubItems(strParentId);


        if(arrTemp != “”)



        {



            arrTemp = arrTemp.split(",");


            for(var i = 0; i < arrTemp.length; i++)



           {



                mygrid.moveRowUp(rowId);



           }



        }



   }



  catch(e)



  {}



}



 



Anyways thanks for ur reply.