Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Lois on Sep 14, 2007 14:51
open dhtmlx forum
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 <rows><row id="22"><cell></cell><cell>Tree Item Text</cell></rows>)
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.
Answer posted by Stanislav on Sep 18, 2007 16:16
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
            }