Rowspan in Grid

There is an opportunity to set a rowspan in a grid.
You can set it in the xml and by the script (using setRowspan method).
setRowspan method has 3 parameters:

  • row id
  • column index
  • rowspan

</> Source
<!DOCTYPE html>
<!--pro-->
<html>
<head>
	<title>Rowspan in Grid</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,Price,In Store,Shipping,Bestseller,Date of Publication");
			myGrid.setInitWidths("80,150,120,80,80,80,80,100");
			myGrid.setColAlign("right,left,left,right,center,left,center,center");
			myGrid.setColTypes("dyn,edtxt,ed,price,ch,co,ra,ro");
			myGrid.setColSorting("str,str,str,str,str,str,str,str");
			myGrid.enableAutoWidth(true);
			myGrid.enableAutoHeight(true);
			myGrid.init();
			myGrid.enableRowspan(true);
			myGrid.load("../common/grid_rowspan.xml",function(){
				myGrid.setRowspan(3,3,3);
				myGrid.setRowspan(3,2,2);
			});
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h1>Rowspan in Grid</h1>
	<p>There is an opportunity to set a rowspan in a grid.<br/> You can set it in the xml and by the script (using setRowspan method).<br/>
	setRowspan method has 3 parameters:
		<ul>
			<li>row id</li>
			<li>column index</li>
			<li>rowspan</li>
		</ul>
	</p>
	<table width="600px">
		<tr>
			<td>
				<div id="gridbox" style="width:100%;height:450px;background-color:white;"></div>
			</td>
		</tr>
		<tr>
			<td>
				<input type="button" name="a1" value="row span (1)" onclick="if(myGrid.getSelectedId()){myGrid.setRowspan(myGrid.getSelectedId(),myGrid.getSelectedCellIndex(),1)} else alert('Cell is not selected !')">
				<input type="button" name="a1" value="row span (2)" onclick="if(myGrid.getSelectedId()){myGrid.setRowspan(myGrid.getSelectedId(),myGrid.getSelectedCellIndex(),2)} else alert('Cell is not selected !')">
				<input type="button" name="a1" value="row span (3)" onclick="if(myGrid.getSelectedId()){myGrid.setRowspan(myGrid.getSelectedId(),myGrid.getSelectedCellIndex(),3)} else alert('Cell is not selected !') ">
			</td>
		</tr>
	</table>
</body>
</html>

Documentation

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