Fixing cells size
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Fixing cells size</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>
<style>
div#layoutObj {
position: relative;
margin-top: 10px;
margin-left: 10px;
width: 600px;
height: 400px;
}
div#controls {
position: relative;
margin-top: 40px;
margin-left: 10px;
}
div.cell_info {
padding: 3px 5px;
font-size: 11px;
font-family: Tahoma;
}
table.controls {
border-top: 1px solid #cecece;
border-left: 1px solid #cecece;
}
table.controls td {
border-right: 1px solid #cecece;
border-bottom: 1px solid #cecece;
font-size: 11px;
font-family: Tahoma;
text-align: center;
}
table.controls tr.tbl_hdr td {
font-size: 13px;
}
</style>
<script>
var myLayout;
function doOnLoad() {
myLayout = new dhtmlXLayoutObject({
parent: "layoutObj",
pattern: "5H"
});
var t = "";
myLayout.forEachItem(function(cell){
var id = cell.getId();
t += "<tr>"+
"<td>"+id+"</td>"+
"<td><input type='checkbox' id='chbx_"+id+"_hor'></td>"+
"<td><input type='checkbox' id='chbx_"+id+"_ver'></td>"+
"<td><input type='button' value='set' onclick='fixSize(\""+id+"\");'></td>";
"</tr>";
updateCellContent(id, false, false);
});
document.getElementById("controls").innerHTML = "<table class='controls' cellspacing='0' cellpadding='5' border='0'>"+
"<tr class='tbl_hdr'>"+
"<td>cell</td>"+
"<td>fix hor direction</td>"+
"<td>fix ver direction</td>"+
"<td> </td>"+
"</tr>"+
t+
"</table>";
}
function updateCellContent(id, h, v) {
myLayout.cells(id).attachHTMLString("<div class='cell_info'>h: "+(h?"fixed":"not fixed")+"<br>v: "+(v?"fixed":"not fixed")+"</div>");
}
function fixSize(id) {
var h = (document.getElementById("chbx_"+id+"_hor").checked==true);
var v = (document.getElementById("chbx_"+id+"_ver").checked==true);
myLayout.cells(id).fixSize(h, v);
updateCellContent(id, h, v);
}
</script>
</head>
<body onload="doOnLoad();">
<div id="layoutObj"></div>
<div id="controls">
</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.