Initialization
Download the DHTMLX Window package as part of the DHTMLX Suite library.
Follow these steps to add DHTMLX Window to an application:
- Include source files
- Initialize Window with the object constructor
- Add content to Window
<!DOCTYPE html>
<html>
<head>
<title>How to Start with DHTMLX Window</title>
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">
</head>
<body>
<script>
// creating DHTMLX Window
const dhxWindow = new dhx.Window({
title: "DHX Window",
modal: false,
resizable: true,
movable: true
});
</script>
</body>
</html>
Include source files
Unpack the downloaded package into your project folder.
Create an HTML file and add the paths to the JS and CSS files of the DHTMLX Suite library in its header. The files are:
suite.jssuite.css
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">
Initialize Window
Initialize Window with the dhx.Window object constructor. The constructor takes an optional parameter:
- An object with configuration properties (optional). If you omit this argument, Window uses the default settings.
Don't use window as the variable name of a Window instance. The browser reserves this name for the global window object.
// creating DHTMLX Window
const dhxWindow = new dhx.Window({
modal: false,
resizable: true,
movable: true
});
dhxWindow.show();
To show a window on a page, call the show() method after you initialize the component.
Configuration properties
The Window API overview article describes the properties you can specify to adapt Window to your needs.
Set content
You can add content to DHTMLX Window in the following ways:
- Use the html property to set the HTML content of a window on initialization:
- Use the attachHTML() method to attach HTML content to a window dynamically:
- Use the attach() method to attach other DHTMLX components to a window: