DHTMLX Docs & Samples Explorer

Cells Header Manipulations

Item:
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>
    <input type="button" value="Show Header" onclick="showPanel();">
    <input type="button" value="Hide Header" onclick="hidePanel();">
    <input type="button" value="Is Header Visible?" onclick="isVisible();">
    <input id="txt" type="text" value="New Text">
    <input type="button" value="Set Text" onclick="setText();">
</div>
<script>
var dhxLayout;
var sel = document.getElementById("sel");
function doOnLoad() {
    dhxLayout = new dhtmlXLayoutObject("parentId", "3L");
    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 setText() {
    dhxLayout.items[getInd()].setText(document.getElementById("txt").value);
}
function isVisible() {
    alert(dhxLayout.items[getInd()].isHeaderVisible());
}
function hidePanel() {
    dhxLayout.items[getInd()].hideHeader();
}
function showPanel() {
    dhxLayout.items[getInd()].showHeader();
}
</script>