Custom HTML

This is an item that contains any custom HTML content (for example, an image, icon or other element).

Adding Custom HTML

Any custom HTML content can be easily added to a sidebar with the help of the add() method of Tree Collection:

sidebar.data.add({
    type: "customHTML",
    id: "userInfo",
    css: "user-info_item",
    html: "<div class='user-info_container'>" +
            "<img class='user-info_avatar' src='../common/ava.png'/>" +
            "<div class='user-info_title'>" +
            "Gloria McKinney"+
            "</div>" +
            "<div class='user-info_contact'>" +
            "@gmckinney" +
            "</div>" +
            "</div>"
});

Related sample:  Custom HTML - DHTMLX Sidebar

Attributes

  • type - (string) required, the item type, set it to "customHTML"
  • id - (string) the id of an item, auto-generated if not set
  • html - (string) a string with HTML that should be inserted into the item
  • css - (string) adds style classes
  • parent - (string) the parent of the item

Working with Custom HTML

You can perform operations over the Custom HTML item with the help of the available Sidebar API and Tree Collection API.

Back to top