The next stop in our journey is a toolbar. We will add a panel with some items to the top of the layout.
We won't provide any handlers for the added items - just will place a toolbar on the page as a part of the overall interface.
To present toolbars on the page, the DHTMLX library provides the dhtmlxToolbar component. The component allows adding various items (buttons, labels, inputs etc.).
We will specify toolbar's items as an object in the XML format that is rather similar to the format used for a standard HTML form.
'index.html' file
dhtmlxEvent(window,"load",function(){
var myLayout = new dhtmlXLayoutObject(document.body,"2U");
myLayout.cells("a").setWidth(250);
myLayout.cells("a").setText("Files");
myLayout.cells("b").hideHeader();
var myToolbar = myLayout.attachToolbar(); });
'index.html' file
dhtmlxEvent(window,"load",function(){
var myLayout = new dhtmlXLayoutObject(document.body,"2U");
myLayout.cells("a").setWidth(250);
myLayout.cells("a").setText("Files");
myLayout.cells("b").hideHeader();
var myToolbar = myLayout.attachToolbar();
myToolbar.setIconsPath("icons/");});
'toolbarStruct.xml' file
<?xml version="1.0" encoding="UTF-8"?>
<toolbar>
<item id="back" type="button" img="left_arrow.png"/>
<item id="fwd" type="button" img="right_arrow.png"/>
<item id="reload" type="button" img="reload.png"/>
<item id="home" type="button" img="home.png"/>
<item id="add" type="button" img="add.png" text="Add"/>
<item id="edit" type="button" img="edit.png" text="Edit"/>
<item id="delete" type="button" img="delete.png" text="Delete"/>
</toolbar>
'index.html' file
dhtmlxEvent(window,"load",function(){
var myLayout = new dhtmlXLayoutObject(document.body,"2U");
myLayout.cells("a").setWidth(250);
myLayout.cells("a").setText("Files");
myLayout.cells("b").hideHeader();
var myToolbar = myLayout.attachToolbar();
myToolbar.setIconsPath("icons/");
myToolbar.loadStruct("data/toolbarStruct.xml");});