Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Aug 05, 2008 02:18
open dhtmlx forum
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.
Answer posted by Support on Aug 05, 2008 07:44

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. 

Answer posted by Tejas Shah on Aug 06, 2008 03:29
Can I some how modify the corresponding js file to achieve such functionalities ?
Answer posted by Support on Aug 06, 2008 03:35
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
Answer posted by Tejas Shah on Aug 08, 2008 05:24
Hi,
    Can I have different context menu for different columns ??
Answer posted by Support on Aug 08, 2008 07:41
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

Answer posted by Tejas Shah on Aug 09, 2008 04:00
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 ?
Answer posted by Support on Aug 11, 2008 07:12

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. 

http://dhtmlx.com/docs/products/dhtmlxGrid/samples/context_menu/pro_context_dynamic.html

>>How to get row Id and Column Id of that cell ?
Such info provided as parameter of context menu event
http://dhtmlx.com/docs/products/dhtmlxGrid/samples/context_menu/pro_context_menu.html