TreeGrid header, right click menu?

Hi,
I was just wondering if anyone has worked out how to add a right click custom menu to the header or footer of a tree grid.

I currently have mygrid.enableContextMenu(menu);
However I have no idea how to add a custom menu to anywhere outside of my actual grid items.
I have tried to add a context menu to “xhdr” with no success
Cheers

Nic

You can add id for the grid header and use it as dhtmlxMenu context zone

Hi Olga,
Thanks for getting back to me.
I have added :

this.hdrBox.setAttribute('id', 'xhdr');

after where the class is added for xhdr (this.hdrBox.className=“xhdr”:wink:

and the following code in the initTreeGrid :

hdr_menu = new dhtmlXMenuObject("xhdr"); hdr_menu.renderAsContextMenu(); hdr_menu.addNewChild(hdr_menu.topId, 0, "new", "New”, false, "new.gif");
however this isn’t working.
Is there something I am missing?
Thanks again
Nic

Check the attached sample, it adds context menu to the header of grid.
1278946873.zip (122 KB)

Hi Stanislav,
Fantastic thank you. I was missing the

mygrid.hdrBox.id = "header";

I also added a menu to my footer :smiley:

mygrid.ftr.id = "footer";

Thanks again

Nic

hi,
can i add menu for tree like this without using tree.enableContextMenu();

Thanks
u me