DHTMLX Docs & Samples Explorer

TreeGrid lines

You can set tree lines in treegrid by enableTreeGridLines method



 

Index of selected
Expand all
Collapse all
Source
<link rel="STYLESHEET" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../../../dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script  src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script  src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script  src="../../codebase/dhtmlxtreegrid.js"></script>
<script  src="../../codebase/ext/dhtmlxtreegrid_lines.js"></script>
 
<style type="text/css" media="screen">
/* this style can be used to remove lines between rows */
.gridbox .obj div, .gridbox .obj td{
    height:18px !important;
}
</style>
 
 
<table width="600">
    <tr>
        <td>
            <div id="gridbox" width="100%" height="250px" style="background-color:white;"></div>
        </td>
    </tr>
    <tr>
        <td>
<div id="gridtbl1" width="100%" height="200px" style="background-color:white;"></div>
<br><br>
<div><a href="#" onclick="mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,0],0)">Add new row</a></div>
<div><a href="#" onclick="var z=mygrid.getRowId(this.nextSibling.value); if (z) mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,1],0,z)">Add new row at child of node at position</a><input></div>
<div><a href="#" onclick="var z=mygrid.getSelectedId(); if (z) mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,1],0,z)">Add new row as child of selected</a></div>
<div>&nbsp;</div>
<div><a href="#" onclick="var z=mygrid.getRowId(this.nextSibling.value); if (z) mygrid.deleteRow(z)">Delete row at position</a><input></div>
<div><a href="#" onclick="mygrid.deleteSelectedItem()">Delete selected rows</a></div>
        </td>
    </tr>
</table>
<hr>
<div><a href="#" onclick="alert(mygrid.getRowIndex(mygrid.getSelectedId()))">Index of selected</a></div>
<div><a href="#" onclick="mygrid.expandAll()">Expand all</a></div>
<div><a href="#" onclick="mygrid.collapseAll()">Collapse all</a></div>
 
<script>
function init() {
    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.setImagePath("../../../dhtmlxGrid/codebase/imgs/csh_bluebooks/");
    mygrid.enableTreeGridLines();
    mygrid.enableMultiselect(true);
    mygrid.enableAutoHeigth(true);
    mygrid.init();
    mygrid.setSkin("dhx_skyblue");
    mygrid.loadXML("../common/treegrid.xml");
}
</script>