DHTMLX Docs & Samples Explorer

Index
dhtmlxgrid
API Methods

### treeToGridElement(treeObj,treeNodeId,gridRowId)

Required library edition:
Required library file: dhtmlxgrid_drag.js

redefine this method in your code to define how tree node values should be used in grid (using input parameters you can change id of new row, values for cells, userdata blocks etc.).

- treeObj - object of tree
- treeNodeId - id of node created in tree
- gridRowId - id of grid row

Returns if true, then tree node should be moved to grid, else - copied

     grid.treeToGridElement = function(tree,treeID,gridID){
            var z=[treeObj.getItemText(treeID)];  // set tree text as a value of the first column in the grid
            return z;
        }

See also: rowToDragElement