Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jennifer on Oct 28, 2008 11:33
open dhtmlx forum
Tabbar with Context Menu?

Is this at all possible in the pro version? If not, what are some "cheats" to get a similar effect? Thanks in advance.
Answer posted by Support on Oct 29, 2008 06:03
The dhtmlx context menu has addContextZone which allows to set context zone for html obejcts. Please, see the sample:

http://www.dhtmlx.com/docs/products/dhtmlxMenu/samples/init/context_zones.html

But tabbat doesn't provide any special API to work with context menu.
Answer posted by Jennifer on Oct 29, 2008 08:17

Thanks for the sample, from that I have produced the following:

Below is performed on init (in the beginning):

var cMenu=new dhtmlXMenuObject();
cMenu.setImagePath("^CLIENTDIR^dhtmlxMenu/codebase/imgs/");
cMenu.setIconsPath("../images/");
cMenu.renderAsContextMenu();
cMenu.loadXMLString('<menu width="100%" height="20" absolutePosition="auto" menuAlign="left" mode="popup" globalCss="contextMenu" globalSecondCss="contextMenu" globalTextCss="contextMenuItem" withoutImages="true"><MenuItem name="Add Header" height="25" width="25" id="add_header"/><MenuItem name="Add Footer" height="25" width="25" id="add_footer"/><MenuItem name="Restore Cell to Default" height="25" width="25" id="reset_cell"/><MenuItem name="Restore Row to Default" height="25" width="25" id="reset_row"/><MenuItem name="Delete Row" height="25" width="25" id="delete_row"/></menu>');

and the below is performed after tabbar tabs are populated from XML.

for (i=0; i<idsSplit.length-1; i++) {   // loop through number of tabs
mytabbar.setLabel(idsSplit[i],"<div id='hello"+i+"'>"+mytabbar.getLabel(idsSplit[i])+"</div>");   // change the labels to include a div with unique id for each tab
cMenu.addContextZone("hello"+i);   // add context zone to each unique div
alert(cMenu.isContextZone("hello"+i));   // verification div is context zone
}

I don't get an error, it's just when I right-click, nothing happens. What might be wrong?

Thanks in advance!

Answer posted by Support on Oct 29, 2008 10:20
The xml structure of Menu 2.0 is different from one of 1.6.

Please, see the menu samples:
dhtmlxMenu/samples/init/context_zones.html