DHTMLX Grid : Different types of Context Menu

Hi there,

Can I have following functionalities in Grid ??



:: Row Header Context menu with different set of options.

:: Column Header Context Menu with different set of options.

:: Cell Based Context Menu with different set of options.


The grid has native support for context menu only in data area, there is no special support for context menu in header area.
You can use dhtmlxMenu or any other context menu script and attach context menu directly to HTML elements of header if necessary.


Can I some how modify the corresponding js file to achieve such functionalities ?

You can use context menu methods withou any code modification

vat cmenu = new dhtmlXContextMenuObject(…
cmenu.setContextZone(grid.hdr,“header”); //attach context menu to grid header

Hi,
    Can I have different context menu for different columns ??

If grid already initialized you can use
var cmenu1 = new dhtmlXContextMenuObject(…
cmenu1.setContextZone(grid.hdr.rows[1].cells[index],“header”); //attach context menu to grid header

var cmenu2 = new dhtmlXContextMenuObject(…
cmenu2.setContextZone(grid.hdr.rows[1].cells[index2],“header”); //attach context menu to grid header





where index,index2 - indexes or columns in question

Hi,
     I want the cells present under that column to have different context menu than other cells; How to do this ? also How to get row Id and Column Id of that cell ?


Only one context menu can be used against data part of grid, but you can use onBeforeConstexMenu event to customize context menu on fly, so it will look different for different columns.



dhtmlx.com/docs/products/dhtmlxG … _menu.html


I added a context menu to the header of the grid. However, I have filters in the grid and I want the context menu to be shown everytime a right click occurs on the header, except for a right click on the textbox for filtering. How to do this?

In other words, I want the context menu to appear on right click on the header on the grid, but not to appear on right click on a textbox for filtering. How to do this?

You can use onRightClick event, and use its fird parameter to detect on which element click occurs.

grid.attachEvent("onRightClick", function(id, index, ev){ var target = ev.target || ev.srcElement; if (ev.tagName.toLowerCase() == "input") return false; return true; })