DHTMLX Docs & Samples Explorer

### Cells Sizing

Item:
Width: 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>
        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>
    <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 setWidth() {
        dhxLayout.items[getInd()].setWidth(Number(document.getElementById("item_w").value));
    }
    function setHeight() {
        dhxLayout.items[getInd()].setHeight(Number(document.getElementById("item_h").value));
    }
    function getWidth() {
        alert(dhxLayout.items[getInd()].getWidth());
    }
    function getHeight() {
        alert(dhxLayout.items[getInd()].getHeight());
    }</script>