Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by techtigre on Mar 09, 2009 08:17
open dhtmlx forum
Stacked toolbars

Is it possible to have two toolbars stacked on top of each other? I have need to have multiple toolbars. Is there a link to a sample?
Answer posted by Alex (support) on Mar 09, 2009 08:28
Toolbar can be initialized in any container you define.
Just for example:

<div id="toolbarObj1"></div>
<div id="toolbarObj2"></div>
<script>
    var webBar1 = new dhtmlXToolbarObject("toolbarObj1");
    webBar1.setIconsPath(...);
    webBar1.loadXML(...);
    var webBar2 = new dhtmlXToolbarObject("toolbarObj2");
    webBar2.setIconsPath(...);
    webBar2.loadXML(...);
</script>

Answer posted by techtigre on Mar 09, 2009 12:17
How about in the case where I already have a dhxLayout..attachToolbar()  object defined, and I want to add an additional toolbar below that one? 
Answer posted by Rachel H. on Mar 09, 2009 20:09
I just did something similar.  Here is how I solved it though there may be other ways.

<div id="folder_pane">
    <div id="toolbar1" width="100%" style="height:25px"></div>
    <div id="toolbar2" width="100%" style="height:25px"></div>
</div>

<script>

    var webBar1 = new dhtmlXToolbarObject("toolbar1");
    webBar1.setIconsPath(...);
    webBar1.loadXML(...);
    var webBar2 = new dhtmlXToolbarObject("toolbar2");
    webBar2.setIconsPath(...);
    webBar2.loadXML(...);

    var layout = "2U";
    var myLayout = new dhtmlXLayoutObject("parentId", layout);

    myLayout.cells("a").setText("My Contacts");
    myLayout.cells("a").setWidth(200);
    myLayout.cells("a").attachObject("folder_pane");

</script>

Attaching the object will attach the entire contents of the div with id=folder_pane.
Answer posted by Alex (support) on Mar 10, 2009 04:42
attachToolbar method doesn't allow to add multiple toolbars. So, the approach provided by Rachel can be used.