Skip to main content

Initialization

info

Download the DHTMLX Sidebar package as part of the DHTMLX Suite library.

Follow these steps to add DHTMLX Sidebar to an application:

<!DOCTYPE html>
<html>
<head>
<title>How to Start with DHTMLX Sidebar</title>
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">
</head>
<body>
<div id="sidebar_container"></div>
<script>
// creating DHTMLX Sidebar
const sidebar = new dhx.Sidebar("sidebar_container");
</script>
</body>
</html>

Related sample: Sidebar. Initialization with config.data

Include source files​

Unpack the downloaded package into your project folder.

Create an HTML file and add the full paths to the JS and CSS files of the DHTMLX Suite library in its header. The files are:

  • suite.js
  • suite.css
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">

Create a container​

Add a container for Sidebar and give it an id, for example sidebar_container:

<div id="sidebar_container"></div>

Initialize Sidebar​

Initialize Sidebar with the dhx.Sidebar object constructor. The constructor takes two parameters:

  • The HTML container for Sidebar
  • An object with configuration properties (optional). If you omit this argument, Sidebar uses the default settings.
const sidebar = new dhx.Sidebar("sidebar_container", {
// config options
});

Configuration properties​

The Sidebar API overview article describes the properties you can specify to adapt Sidebar to your needs.

Load data into Sidebar​

The Data loading article explains how to load data into DHTMLX Sidebar.

Example​