Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mike Addesa on Aug 30, 2007 23:13
open dhtmlx forum
attaching context menu to headers

Is there a way to make context menus popup when right clicking on column headers? Is there a way to filter from context menus?
Answer posted by Stanislav on Sep 03, 2007 13:23
>>Is there a way to make context menus popup when right clicking on column headers?
While columns not activate context menu by default, you can use dhtmlxMenu functionality, which allow to attach it to any HTML container

grid=new dht...
aMenu = new dht....

aMenu.setContextZone(grid.hdr.rows[1].cells[0],"header1");
    where grid.hdr.rows[1].cells[0] - html tag of first column

>>Is there a way to filter from context menus?
You can attach any functionality to context menu items.
Answer posted by Tejas Shah on Aug 08, 2008 04:24
Hi,
     How can I get the column Id of the column on whose header, the right click context menu was clicked ?
     Also I want the added column to have all cell colors = white and its header color = yellow;
     How to achieve this ?
    
Answer posted by Support on Aug 08, 2008 05:09
If you attaching menu directly to HTML element - it will not provide any info related to grid structure, because it not related to grid, but just to some HTML container.

>> Also I want the added column to have all cell colors = white and its header color = yellow;
http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=4435&ssr=yes&s=add%20column
Answer posted by Tejas Shah on Aug 08, 2008 05:22
Hi,
     I am attaching context menu to the column header, not to any other HTML object, so we can get the column id, right ?
Answer posted by Tejas Shah on Aug 08, 2008 06:51
Hi,
    Suppose I want hide the context menu of Column Header, if I don't select any of the options and click somewhere else.. How to do this ?
Answer posted by Support on Aug 08, 2008 09:22
Context menu automatically close itself when click occurs outside of it.
You can force context menu closing by 
    aMenu._contextEnd();
Answer posted by Tejas Shah on Aug 09, 2008 02:42
Hi,
     I am attaching context menu to the column header, not to any other HTML object, so we can get the column id, right ?
Answer posted by Support on Aug 11, 2008 07:14
If you are using 
    grid.enableContextMenu(
you are attaching context menu to the grid, so event will receive info about row|column where click occurs. 

In any other case you are attaching menu to HTML element , and will not receive any additional info. 
>>aMenu.setContextZone(grid.hdr.rows[1].cells[0],"header1");
the "header1" will be received as ID of element for which context menu called