DHTMLX Docs & Samples Explorer

Fixing Cells Sizes

Item:     Fix Width:     Fix Height:    
Source
<link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxlayout.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxlayout_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxlayout.js"></script>
<script src="../../codebase/dhtmlxcontainer.js"></script>
 
<div id="parentId" style="position: relative; top: 20px; left: 20px; width: 600px; height: 400px; aborder: #B5CDE4 1px solid;"></div>
<div style="position: relative; margin-top: 40px; margin-left: 20px;">
    Item: <select id="sel"></select>
    &nbsp;&nbsp;&nbsp;
    Fix Width: <select id="fw"><option value="true">true</option><option value="false">false</option></select>
    &nbsp;&nbsp;&nbsp;
    Fix Height: <select id="fh"><option value="true">true</option><option value="false">false</option></select>
    &nbsp;&nbsp;&nbsp;
    <input type="button" value="Fix Size" onclick="fixSize();">
</div>
<script>
var dhxLayout;
var sel = document.getElementById("sel");
function doOnLoad() {
    dhxLayout = new dhtmlXLayoutObject("parentId", "5I");
    dhxLayout.forEachItem(function(item) {
        sel.options.add(new Option(item.getId(), item.getIndex()));
    });
}
function getInd() {
    var sel = document.getElementById("sel");
    var id = sel.options[sel.selectedIndex].value;
    return id;
}
function getState(id) {
    var sel = document.getElementById(id);
    if (sel.selectedIndex == 0)
        return true;
    return false;
}
function fixSize() {
    dhxLayout.items[getInd()].fixSize(getState("fw"), getState("fh"));
}
</script>