How to hide/show a toolbar in layout

Hi

Is it possible to show/hide a whole toolbar in a layout cell with an attached grid?

I wish to add several toolbars and show/hide these toolbars depending on the grid content.

Thanks

Hi,

You may use showToolbar/hideToolbar methods:

docs.dhtmlx.com/doku.php?id=dhtm … wtoolbar&s[]=showToolbar

In fact I would like to add several toolbars in the layout cell.

t1=dhx.cell(‘a’).attachToolbar();
t2=dhx.cell(‘a’).attachToolbar();
t3=dhx.cell(‘a’).attachToolbar();

And show only t2 and not the others then hide t2 and show the others but it seems it’s not possible with these methods.

I don’t see any solution for that.

Yes, the components like layout, windows and accordion were not designed to contain more than one toolbar per a cell. But possibly the following approach will do:

t1=dhx.cell(‘a’).attachToolbar();
t2=dhx.cell(‘a’).attachToolbar();
t3=dhx.cell(‘a’).attachToolbar();

/to show t2/
showToolbars([t2]);

/to show t1,t3/
showToolbars([t1,t3]);

function showToolbars(toolbars){
t1.cont.style.display = “none”;
t2.cont.style.display = “none”
t3.cont.style.display = “none”

for(var i = 0 ; i < toolbars.length;i ++)
toolbars[i].cont.style.display = "";
dhxLayout.setSizes();

}

Here cont is a private toolbar property, the object of toolbar container.

Is there a way to hide a menu bar?

when trying:

menubar.cont.style.display = "none";
layout.setSizes();

The items inside the menu bar are hidden, yet the menubar is shows.

I want to hide a menubar and then show a toolbar which was previously hidden. And then be able to toggle back and forth.

I figured it out:

menubar.cont.parentNode.style.display = "none";

The menubar is bit smaller than the toolbar, so the screen moves a bit. Wonder if there is a way to fix that?