Getting Started
jqxDockingLayout represents a jQuery widget which allows the creation of complex layouts with panels that can be floated, docked, nested, resized, pinned, unpinned and closed.Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.
The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDockingLayout widget requires the following files:
<head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxribbon.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlayout.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdockinglayout.js"></script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
The next step is to create a DIV element within the body of the html document and add a div for each of the docking layout's panels with the panel's content in it. The div structure can be flat and does not have to correspond to the panels' hierarchy. Each div has to have its data-container attribute set to a value which will later be referenced in the layout array in the JavaScript code.
<div id="jqxDockingLayout"> <!--autoHideGroup--> <div data-container="ToolboxPanel"> List of tools</div> <div data-container="HelpPanel"> Help topics</div> <!--documentGroup--> <div data-container="Document1Panel"> Document 1 content</div> <div data-container="Document2Panel"> Document 2 content</div> <!--bottom tabbedGroup--> <div data-container="ErrorListPanel"> List of errors</div> <!--right tabbedGroup--> <div data-container="SolutionExplorerPanel"> Solution structure</div> <div data-container="PropertiesPanel"> List of properties</div> <!--floatGroup--> <div data-container="OutputPanel"> Output</div></div>
The last step is to initialize the widget by adding the following script to the html document:
<script type="text/javascript"> $(document).ready(function () { // the 'layout' JSON array defines the internal structure of the docking layout var layout = [{ type: 'layoutGroup', orientation: 'horizontal', items: [{ type: 'autoHideGroup', alignment: 'left', width: 80, unpinnedWidth: 200, items: [{ type: 'layoutPanel', title: 'Toolbox', contentContainer: 'ToolboxPanel' }, { type: 'layoutPanel', title: 'Help', contentContainer: 'HelpPanel' }] }, { type: 'layoutGroup', orientation: 'vertical', width: 500, items: [{ type: 'documentGroup', height: 400, minHeight: 200, items: [{ type: 'documentPanel', title: 'Document 1', contentContainer: 'Document1Panel' }, { type: 'documentPanel', title: 'Document 2', contentContainer: 'Document2Panel' }] }, { type: 'tabbedGroup', height: 200, pinnedHeight: 30, items: [{ type: 'layoutPanel', title: 'Error List', contentContainer: 'ErrorListPanel' }] }] }, { type: 'tabbedGroup', width: 220, minWidth: 200, items: [{ type: 'layoutPanel', title: 'Solution Explorer', contentContainer: 'SolutionExplorerPanel' }, { type: 'layoutPanel', title: 'Properties', contentContainer: 'PropertiesPanel' }] }] }, { type: 'floatGroup', width: 500, height: 200, position: { x: 350, y: 250 }, items: [{ type: 'layoutPanel', title: 'Output', contentContainer: 'OutputPanel' }] }]; $('#jqxDockingLayout').jqxDockingLayout({ width: 800, height: 600, layout: layout }); });</script>
To call a function(method), you need to pass the method name and parameters(if any) in the jqxDockingLayout’s constructor.
$("#jqxDockingLayout").jqxDockingLayout("destroy");To set a property(option), you need to pass the property name and value(s) in the jqxDockingLayout's constructor.
$("#jqxDockingLayout").jqxDockingLayout({ rtl: true });To get a property(option), you need to pass the property name to the jqxDockingLayout's constructor.
var width = $("#jqxDockingLayout").jqxDockingLayout("width");To bind to an event of a UI widget, you can use basic jQuery syntax. The example code below demonstrates how to bind to the "resize" event of jqxDockingLayout.
// bind to resize event. $('#jqxDockingLayout').on('resize', function () { alert('A panel group has been resized.'); });
Basic Sample
<!DOCTYPE html><html lang="en"><head> <title>jQuery Docking Layout Sample</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <style type="text/css"> .jqx-layout-group-auto-hide-content-vertical { width: 200px; } </style> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxribbon.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlayout.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdockinglayout.js"></script> <script type="text/javascript"> $(document).ready(function () { // the 'layout' JSON array defines the internal structure of the docking layout var layout = [{ type: 'layoutGroup', orientation: 'horizontal', items: [{ type: 'autoHideGroup', alignment: 'left', width: 80, unpinnedWidth: 200, items: [{ type: 'layoutPanel', title: 'Toolbox', contentContainer: 'ToolboxPanel' }, { type: 'layoutPanel', title: 'Help', contentContainer: 'HelpPanel' }] }, { type: 'layoutGroup', orientation: 'vertical', width: 400, items: [{ type: 'documentGroup', height: 400, minHeight: 200, items: [{ type: 'documentPanel', title: 'Document 1', contentContainer: 'Document1Panel' }, { type: 'documentPanel', title: 'Document 2', contentContainer: 'Document2Panel' }] }, { type: 'tabbedGroup', height: 200, pinnedHeight: 30, items: [{ type: 'layoutPanel', title: 'Error List', contentContainer: 'ErrorListPanel' }] }] }, { type: 'tabbedGroup', width: 220, minWidth: 200, items: [{ type: 'layoutPanel', title: 'Solution Explorer', contentContainer: 'SolutionExplorerPanel' }, { type: 'layoutPanel', title: 'Properties', contentContainer: 'PropertiesPanel' }] }] }, { type: 'floatGroup', width: 200, height: 200, position: { x: 150, y: 150 }, items: [{ type: 'layoutPanel', title: 'Output', contentContainer: 'OutputPanel' }] }]; $('#jqxDockingLayout').jqxDockingLayout({ width: 700, height: 600, layout: layout }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body> <div id="jqxDockingLayout"> <!--autoHideGroup--> <div data-container="ToolboxPanel"> List of tools</div> <div data-container="HelpPanel"> Help topics</div> <!--documentGroup--> <div data-container="Document1Panel"> Document 1 content</div> <div data-container="Document2Panel"> Document 2 content</div> <!--bottom tabbedGroup--> <div data-container="ErrorListPanel"> List of errors</div> <!--right tabbedGroup--> <div data-container="SolutionExplorerPanel"> Solution structure</div> <div data-container="PropertiesPanel"> List of properties</div> <!--floatGroup--> <div data-container="OutputPanel"> Output</div> </div></body></html>