Markers
Markers functionality allows to select individual cells. You can also select several cells by shift-click and ctrl-click.
unmark all | get marked cells |
Markers functionality allows to select individual cells. You can also select several cells by shift-click and ctrl-click.
unmark all | get marked cells |
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css"> <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css"> <script src="../../codebase/dhtmlxcommon.js"></script> <script src="../../codebase/dhtmlxgrid.js"></script> <script src="../../codebase/dhtmlxgridcell.js"></script> <script src="../../codebase/ext/dhtmlxgrid_markers.js"></script> <table> <tr><td> <div id="gridbox" style="width:400px;height:270px;background-color:white;overflow:hidden;"></div> </td> <td style="padding-left:25" valign="top"> <div id="logarea" style="background-color:lightgrey;height:270px;width:250px;overflow:auto; padding:3px;"></div> </td></tr> <tr><td> <a href="javascript:void(0)" onclick="mygrid.unmarkAll()">unmark all</a> </td> <td style="padding-left:25" valign="top"> <a href="javascript:void(0)" onclick="mark()">get marked cells</a> </td></tr> </table> <br> <script></script>mygrid = new dhtmlXGridObject('gridbox'); mygrid.setImagePath("../../codebase/imgs/"); mygrid.setHeader("Sales,Book Title,Author"); mygrid.setInitWidths("100,250,100"); mygrid.setColAlign("right,left,left"); mygrid.setColTypes("ro,ed,ed"); mygrid.setColSorting("int,str,str"); mygrid.enableMarkedCells(); mygrid.init(); mygrid.setSkin("dhx_skyblue"); mygrid.loadXML("../common/grid_16_rows_columns_manipulations.xml"); function mark() { var markedArray = mygrid.getMarked(); document.getElementById("logarea").innerHTML += "All marked cells:<br/>["; for (var i = 0; i < markedArray.length; i++) { document.getElementById("logarea").innerHTML += "{ " + markedArray[i].toString() + " }"; } document.getElementById("logarea").innerHTML += "]<br/>"; } function doLog(str) { var log = document.getElementById("logarea"); log.innerHTML = log.innerHTML + str + "</br>"; log.scrollTop = log.scrollHeight; }