DHTMLX Docs & Samples Explorer

Dock/UnDock Event Handling

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>
<link rel="stylesheet" type="text/css" href="../../../dhtmlxWindows/codebase/dhtmlxwindows.css">
<link rel="stylesheet" type="text/css" href="../../../dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_skyblue.css">
<script src="../../../dhtmlxWindows/codebase/dhtmlxwindows.js"></script>
<script src="../../../dhtmlxWindows/codebase/engine/dhtmlxwindows_enginedhx.js"></script>
<script src="../../codebase/dhtmlxcontainer.js"></script>
 
<div id="winVP" style="position: relative; height: 500px; margin: 10px;">
    <div id="parentId" style="position: relative; top: 10px; left: 10px; width: 600px; height: 400px; aborder: #B5CDE4 1px solid;"></div>
</div>
<div id="log" style="position: relative; margin-top: 40px; margin-left: 20px; width: 600px; height: 120px; border: #909090 1px solid; overflow-y: scroll; font-family: Tahoma; font-size: 11px;">
</div>
<div id="objA" style="text-align: center; padding-top: 10px;"><input type="button" value="undock" onclick="dhxLayout.cells('a').undock();"></div>
<div id="objB" style="text-align: center; padding-top: 10px;"><input type="button" value="undock" onclick="dhxLayout.cells('b').undock();"></div>
<div id="objC" style="text-align: center; padding-top: 10px;"><input type="button" value="undock" onclick="dhxLayout.cells('c').undock();"></div>
<script>
var dhxLayout;
function doOnLoad() {
    dhxLayout = new dhtmlXLayoutObject("parentId", "3L");
    dhxLayout.dhxWins.enableAutoViewport(false);
    dhxLayout.dhxWins.attachViewportTo("winVP");
    dhxLayout.attachEvent("onDock", doOnDock);
    dhxLayout.attachEvent("onUnDock", doOnUnDock);
    dhxLayout.cells("a").attachObject("objA");
    dhxLayout.cells("b").attachObject("objB");
    dhxLayout.cells("c").attachObject("objC");
}
function doOnDock(itemId) {
    document.getElementById("log").innerHTML += "<b>onDock</b> event called, item id is <b>" + itemId + "</b><br>";
}
function doOnUnDock(itemId) {
    document.getElementById("log").innerHTML += "<b>onUnDock</b> event called, item id is <b>" + itemId + "</b><br>";
    dhxLayout.dhxWins.window(itemId).keepInViewport(true);
}
</script>