dhtmlXTreeGrid

I have a grid and tree-grid in a page. When I drag and drop a node item of tree-grid on an empty grid(say mygrid), I want to set the item text of the tree node to the 2nd cell of mygrid. (i.e serialized mygrid string should look like Tree Item Text)

Is it possible to do so?

I tried the below:

             mygrid.treetoGridElement = treeToMyGrid;

            function treeToMyGrid(treeObj,treeNodeId,gridRowId){

                this.addRow(gridRowId,treeObj.getItemText(treeNodeId),1);

                //this.cells(gridRowId,1).setValue(treeObj.getItemText(treeNodeId));

            }

I get 2 rows added to mygrid.

One is a row with id=treeNodeId and empty cells; another is row with undefined id and first cell having item text of tree node.



Also I want to record this action in another grid, like treeObj.getItemText(treeNodeId) is dragged to mygrid.

Can you give some suggestions.

  1. treeToGridElement functin executed only for drag-n-drop
        tree => grid
    drag and drop between grid and tree-grid works same as between two grids

    2) In latest version of dhtmlxgrid correct code can be similar to next

               function treeToMyGrid(treeObj,treeNodeId,gridRowId){

                    return ["",treeObj.getItemText(treeNodeId)]; //return array of cell values
                }