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
</> Source
<!DOCTYPE html>
<!--pro-->
<html>
<head>
	<title>Markers</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var myGrid;
		function doOnLoad(){
			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.enableAutoWidth(true);
			myGrid.enableAutoHeight(true);
			myGrid.init();
			myGrid.load("../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;
		}
	</script>
</head>
<body onload="doOnLoad()">
	<h1>Markers</h1>
	<p>Markers functionality allows to select individual cells. You can also select several cells by shift-click and ctrl-click.</p>
	<table>
		<tr><td>
			<div id="gridbox" style="width:400px;height:450px;background-color:white;overflow:hidden;"></div>
		</td>
		<td style="padding-left:25" valign="top">
			<div id="logarea" style="background-color:#d3d3d3;height:390px;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>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.