Custom Elements Documentation
Getting Started
jqxDocking is a HTML Element which enables the user to add windows and change their layout.Every UI element 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 jqxDocking element requires the following
files:
The next step is to add the html element within the body of the html page.<script type="text/javascript" src="../scripts/webcomponents-lite.min.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxcore.elements.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxdata.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxwindow.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxdocking.js"></script>
The last step is to initialize the element settings:<jqx-docking settings="elementSettings"></jqx-docking>
To call a function(method), you need to pass the method name and parameters(if any) in the jqxDocking's instance.<script type="text/javascript">
JQXElements.settings["elementSettings"] =
{
cookies:true, theme:"light"
}
</script>
To get the result of a function after calling it, you can use the following syntax:<script>
window.onload = function () {
var element = document.querySelector("jqx-docking");
element.addWindow();
}
</script>
To set a property(option), you need to use the property name and value(s) along with the jqxDocking's instance.<script>
window.onload = function () {
var element = document.querySelector("jqx-docking");
var result = element.exportLayout();
}
</script>
You can also set properties of HTML Elements by using Attributes. Traditionally, attributes are used to set the initial state of an element. Properties with camelCase naming have dash-based attributes. For example: A property "dataSource" will have an attribute called "data-source".window.onload = function() {
document.querySelector("jqx-docking").cookies = false;
}
To get a property(option), you need to use the property name along with the jqxDocking's instance.
window.onload = function() {
var propertyValue = document.querySelector("jqx-docking").cookies;
}
Event binding can be defined in the HTML as an attribute. The syntax is: 'on-' and the event's name. Event Names with camelCase naming have dash-based attributes. The attribute's value is the event handler's name. The addEventListener
function can also be used for event binding.
<script>
window.onload = function () {
var element = document.querySelector("jqx-docking");
element.addEventListener("dragStart", function(event){
// Your code here
});
}
</script>
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>Docking Custom Element Settings</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.light.css" type="text/css" />
<link rel="stylesheet" href="../../styles/demos.css" type="text/css" />
<script type="text/javascript" src="../../scripts/webcomponents-lite.min.js"></script><script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script><script type="text/javascript" src="../../jqwidgets/jqxcore.elements.js"></script><script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script><script type="text/javascript" src="../../jqwidgets/jqxdocking.js"></script><script type="text/javascript">JQXElements.settings["dockingSettings"] ={cookies:true, theme:"light"}</script></head><body><div class="example-description">Docking Custom Element</div><jqx-docking settings="dockingSettings"><div><div id="window0" style="height: 150px"><div>CISC</div><div>Before the RISC philosophy became prominent, many computer architects tried to bridgethe so called semantic gap, i.e. to design instruction sets that directly supportedhigh-level programming constructs such as procedure calls, loop control, and complex...</div></div><div id="window1" style="height: 150px"><div>Database management system</div><div>A database management system (DBMS) is a software package with computer programsthat control the creation, maintenance, and the use of a database. It allows organizationsto conveniently develop databases...</div></div></div><div><div id="window2" style="height: 150px"><div>RISC</div><div>Some aspects attributed to the first RISC-labeled designs around 1975 include theobservations that the memory-restricted compilers of the time were often unableto take advantage...</div></div></div></jqx-docking></body></html>