Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen on May 06, 2009 13:35
open dhtmlx forum
Removing empty menu bar when using context menu in a cell

Is there a way of removing the empty menu bar when using attachMenu() in a cell? The menu is to be used as a context menu.

I set the text for the cell with
layout.cells("a").setText("Test");
and when I then add
menu = leftLayout.cells("a").attachMenu();
I get an empty bar below the cell header with "Test"

I want use the context menu with a tree in the same cell using
tree.enableContextMenu(menu);

Answer posted by Alex (support) on May 07, 2009 01:36

If you want to use context menu, you shouldn't use attachMenu() method. 

Try to use the common way of context menu intialization:

menu = new dhtmlXMenuObject();
...
menu.renderAsContextMenu();
...

and then you can attach it to the tree:

tree.enableContextMenu(menu);

Answer posted by Stephen on May 07, 2009 01:56
Thanks Alex that worked,
I had attached the menu to a cell in the layout and so used attachMenu() but then decided to use a tree in the cell and attach to this instead but I did not realise I had to change the attach method.

Answer posted by Alex (support) on May 07, 2009 02:52
Yes, we use attachMenu() to attach a horizontal menu to a cell. For context menu - new dhtmlXMenuObject().