Grid related API
Use same methods in Grid and TreeGrid
Use same methods in Grid and TreeGrid
<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/ext/dhtmlxgrid_drag.js"></script> <script src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="../../codebase/dhtmlxtreegrid.js"></script> <table width="700"> <tr> <td width="50%" valign="top"> <div id="gridbox" style="width=350px;height:150px;background-color:white;"></div> </td> <td valign="top"> <div id="gridbox2" style="width=350px;height:150px;background-color:white;border:1px solid blue;" align="right"></div> </td> </tr> <tr> <td colspan="2"> <table> <tr> <td> <a href="javascript:mygrid.setHeaderCol(1,'New Header')">setHeaderCol</a><br> <a href="javascript:mygrid.copyRowContent(mygrid.getRowId(0),mygrid.getSelectedId())">copyRowContent (ex.:from first to selected)</a><br> <a href="javascript:mygrid.clearSelection()">clearSelection</a><br> <a href="javascript:mygrid.setSelectedRow(mygrid.getRowId(1))">setSelectedRow (ex.:second)</a><br> <a href="javascript:mygrid.setEditable(!mygrid.isEditable)">setEditable (ex.:on/off)</a><br> <a href="javascript:mygrid.setUserData(mygrid.getSelectedId(),'ud2','this value was set with script')">setUserData (ex.: to selected row)</a><br> <a href="javascript:alert(mygrid.getUserData(mygrid.getSelectedId(),'ud2'))">getUserData (ex.: of selected row)</a><br> <a href="javascript:mygrid.moveRowDown(mygrid.getSelectedId())">moveRowDown (ex.:selected)</a><br> <a href="javascript:mygrid.moveRowUp(mygrid.getSelectedId())">moveRowUp (ex.:selected)</a><br> <a href="javascript:alert(mygrid.getColumnCount())">getColumnCount</a><br> <a href="javascript:alert(mygrid.getRowsNum())">getRowsNum</a><br> <a href="javascript:alert(mygrid.getAllItemIds())">getAllItemIds</a><br> <a href="javascript:alert(mygrid.isItemExists('14'))">isItemExists (with id=14)</a><br> <a href="javascript:mygrid.setRowTextStyle(mygrid.getSelectedId(),'color:red;font-family:verdana;font-size:14px;')">setRowTextStyle (ex.:selected)</a><br> <a href="javascript:mygrid.setRowTextBold(mygrid.getSelectedId())">setRowTextBold (ex.:selected)</a><br> <a href="javascript:mygrid.setRowTextNormal(mygrid.getSelectedId())">setRowTextNormal (ex.:selected)</a><br> <a href="javascript:mygrid.clearAll()">clearAll</a><br> </td> <td> <a href="javascript:mygrid.setColumnIds('A,B')">setColumnIds (A,B)</a><br> <a href="javascript:alert(mygrid.getColumnId(0))">getColumnId (ex.:first)</a><br> <a href="javascript:alert(mygrid.getColIndexById('B'))">getColIndexById (ex.: B)</a><br> <a href="javascript:mygrid.setRowId(mygrid.getRowIndex(mygrid.getSelectedId()),'newid')">setRowId (ex.: selected)</a><br> <a href="javascript:alert(mygrid.getRowId(mygrid.getRowIndex(mygrid.getSelectedId())))">getRowId (ex.:selected)</a><br> <a href="javascript:alert(mygrid.getRowIndex(mygrid.getSelectedId()))">getRowIndex (ex.:selected)</a><br> <a href="javascript:alert(mygrid.getColWidth(mygrid.getSelectedCellIndex()))">getColWidth (ex.:of selected cell)</a><br> <a href="javascript:alert(mygrid.getSelectedCellIndex())">getSelectedCellIndex</a><br> <a href="javascript:alert(mygrid.getSelectedId())">getSelectedId</a><br> <a href="javascript:mygrid.deleteSelectedItem()">deleteSelectedItem</a><br> <a href="javascript:void(0)" onclick="mygrid.deleteRow(mygrid.getSelectedId())">deleteRow (ex.: selected)</a><br> <a href="javascript:mygrid.setMultiselect(!mygrid.selMultiRows)">setMultiselect (on/off)</a><br> <a href="javascript:mygrid.selectRow(0)">selectRow (ex.:first one)</a><br> <a href="javascript:mygrid.selectCell(1,1)">selectCell (ex.: second cell of second row)</a><br> <a href="javascript:mygrid.attachToObject(document.getElementById('gridbox2'))">attachToObject</a><br> </td> </tr> </table> </td> </tr> </table> <script></script>mygrid = new dhtmlXGridObject('gridbox'); mygrid.selMultiRows = true; mygrid.imgURL = "../../../dhtmlxGrid/codebase/imgs/icons_greenfolders/"; mygrid.setHeader("Car,Mileage,Volume,State A,State B"); mygrid.setInitWidths("150,100,100,50,50"); mygrid.setColAlign("left,left,left,center,center"); mygrid.setColTypes("tree,ed,txt,ch,ch"); mygrid.setColSorting("str,str,str,na,str"); mygrid.init(); mygrid.setSkin("dhx_skyblue"); mygrid.loadXML("../common/test_list_1.xml");