Trying to use a context menu in a grid. When right clicking on grid nothing shows and no errors are detected. Browser context menu doesn’t show either so I thought maybe it is a z-index conflict maybe? Tried in several browsers. Grid uses splitAt(3) and dataprocessor but not much special other than that. What would cause the menu not to show at all?
I found if I remove the grid.attachEvent(“onBeforeContextMenu” action it works fine.
I don’t seem to be getting any responses so here is some more detail to help find the issue.
I am using tabbar, grid and context menu together.
HTML
<div id="configureTabbar"></div>
<div id="configureGridLineDetail" style="width:100%; height:100%;"></div>
<script type="text/javascript">
$(document).ready(function(){
// call ext js file with dhtmlx object
});
</script>
External JS File
tabContainer = new dhtmlXTabBar("configureTabbar", "top");
tabContainer.setImagePath(imgDir);
tabContainer.addTab("tab1", "1", "150px");
tabContainer.addTab("tab2", "2", "150px");
tabContainer.addTab("tab3", "3", "150px");
tabContainer.addTab("tab4", "4", "150px");
tabContainer.setTabActive("tab3");
gridContext = new dhtmlXMenuObject();
gridContext.setIconsPath(imgDir);
gridContext.renderAsContextMenu();
gridContext.attachEvent("onClick", contextMenuClick);
gridContext.loadXML(mainContext.xml?sid='+Math.random());
gridMain = new dhtmlXGridObject('configureGridLineDetail');
gridMain.setImagePath(imgDir);
gridMain.enableContextMenu(gridContext);
gridMain.init();
// If I uncomment this event the context menu no longer works
// gridMain.attachEvent("onBeforeContextMenu", contextMenuOpen);
gridMain.setSkin('dhx_skyblue');
gridMain.splitAt(3);
gridMain.loadXML(main.php?sid='+Math.random());
tabContainer.setContent("tab3", "configureGridLineDetail");
// also use dataprocessor
function contextMenuOpen(rowId, colInd, grid){alert(colInd);}
Still no luck with getting our grid events attached…
The answer was to add “return true;” to the formula.
function contextMenuOpen(rowId, colInd, grid){
alert(colInd);
return true;
}