onDock / onUnDock events
onDock / onUnDock
Item:
logs
</> Source
<!DOCTYPE html>
<html>
<head>
<title>onDock / onUnDock events</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: 500px;
height: 300px;
}
div#winVP {
position: relative;
height: 400px;
border: #dfdfdf 1px solid;
margin: 10px;
}
div.info {
margin: 0px 10px;
font-weight: bold;
font-size: 15px;
color: #3b5e7c;
}
div#logsHere {
position: relative;
height: 100px;
border: #dddddd 1px solid;
padding: 4px;
margin: 30px 10px 10px 10px;
font-size: 14px;
font-family: Roboto, Arial, Helvetica;
color: #404040;
overflow: auto;
}
</style>
<script>
var sel;
var myLayout,myGrid,myMenu,myToolbar;
function doOnLoad() {
myLayout = new dhtmlXLayoutObject({
parent: "layoutObj",
pattern: "2U"
});
// change window's viewport
myLayout.dhxWins.attachViewportTo("winVP");
sel = document.getElementById("sel");
myLayout.forEachItem(function(item){sel.options.add(new Option(item.getId(),item.getId()));});
myMenu = myLayout.cells("a").attachMenu({
icons_path: "../../../dhtmlxMenu/samples/common/imgs/",
xml: "../../../dhtmlxMenu/samples/common/dhxmenu.xml"
});
myGrid = myLayout.cells("a").attachGrid();
myGrid.setImagePath("../../../codebase/imgs/")
myGrid.load("../common/grid.xml");
myLayout.attachEvent("onDock", function(id){
writeLog("event onDock called, cell "+id);
});
myLayout.attachEvent("onUnDock", function(id){
writeLog("event onUnDock called, cell "+id);
});
}
function getId() {
var sel = document.getElementById("sel");
var id = sel.options[sel.selectedIndex].value;
return id;
}
function dockCell() {
myLayout.cells(getId()).dock();
}
function undockCell() {
myLayout.cells(getId()).undock(550,20,400,300);
}
function writeLog(text) {
document.getElementById("logsHere").innerHTML += "<br>"+text;
document.getElementById("logsHere").scrollTop = document.getElementById("logsHere").scrollHeight;
}
function doOnUnload() {
if (myLayout != null && myLayout.unload != null) {
myLayout.unload();
myLayout = null;
}
}
</script>
</head>
<body onload="doOnLoad();" onunload="doOnUnload();">
<div class="info">
<div class="info_title">onDock / onUnDock</div>
</div>
<div id="winVP">
<div id="layoutObj"></div>
</div>
<div style="margin-left: 10px; margin-top:20px;">
Item: <select id="sel"></select>
<input type="button" value="dock" onclick="dockCell();">
<input type="button" value="undock" onclick="undockCell();">
</div>
<div id="logsHere">logs</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.