Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Micha Hastrich on Jan 18, 2010 02:44
open dhtmlx forum
Context Menu for Tabbar

Hi,

Is it possible to attach a Contextmenu to a Tabbar?

I want to add the functionality to

* close all Tabs
* close all Tabs except the activ one

I have a script for closing all tabs, but don't know how to build up the contextmenu.
Answer posted by Alex (support) on Jan 18, 2010 02:59

Hello

there isn't built-in functionlaity. You can use the following appproach to attach dhtmlxmenu as context menu to tabbar header:

tabbar._tabZone.id="theader";

menu.addContextZone("theader");

where tabbar is tabbar object, menu is menu object.

Answer posted by Micha Hastrich on Jan 18, 2010 06:32
Sorry, i don't get it working.

>> dhxtabbar._tabZone.id="theader";

dhxtabbar._tabZone.id is a global variable for the Tabbar or do i have to set it for each Tab?

I'm doing the following initialization:

var menu1;
function initMenu() {
    menu1 = new dhtmlXMenuObject();
    menu1.setIconsPath("dhtmlx/imgs/");
    menu1.renderAsContextMenu();
    dhxtabbar._tabZone.id="theader";
    menu1.addContextZone("theader");
    menu1.loadXML("dhxmenu.xml");
}

anything wrong here?
Answer posted by Alex (support) on Jan 18, 2010 07:47

_tabZone is an exstent tabbar property (private). It is a container with tabs. 

dhxtabbar._tabZone.id sets id for that container in order to apply addContextZone.  The provided code looks correct. Please provide the complete demo to recreate the issue