Cells sizing
Item:
Width:
Height:
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Cells sizing</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;
}
</style>
<script>
var myLayout;
var sel;
function doOnLoad() {
myLayout = new dhtmlXLayoutObject({
parent: "layoutObj",
pattern: "5H"
});
sel = document.getElementById("sel");
myLayout.forEachItem(function(item){sel.options.add(new Option(item.getId(),item.getId()));});
}
function getInd() {
var sel = document.getElementById("sel");
var id = sel.options[sel.selectedIndex].value;
return id;
}
function setWidth() {
myLayout.cells(getInd()).setWidth(Number(document.getElementById("item_w").value));
}
function setHeight() {
myLayout.cells(getInd()).setHeight(Number(document.getElementById("item_h").value));
}
function getWidth() {
alert(myLayout.cells(getInd()).getWidth());
}
function getHeight() {
alert(myLayout.cells(getInd()).getHeight());
}
</script>
</head>
<body onload="doOnLoad();">
<div id="layoutObj"></div>
<div style="position: relative; margin-top: 40px; margin-left: 10px;">
Item: <select id="sel"></select>
Width: <input id="item_w" type="text" value="200" style="width: 50px;">
<input type="button" value="Set Width" onclick="setWidth();">
<input type="button" value="Get Width" onclick="getWidth();">
Height: <input id="item_h" type="text" value="200" style="width: 50px;">
<input type="button" value="Set Height" onclick="setHeight();">
<input type="button" value="Get Height" onclick="getHeight();">
</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.