:: Forum >> Version 1 >>

How do I attach a context menu to the grid body?

Hello Everybody!

Is it possible to attach a "oncontextmenu" event to the grid body?

I have a grid with a height of 500px. In the upper half of the grid some rows are visible and the lower half is empty. Now I attached a contextmenu to the rows with:

var rowt = new Active.Templates.Row;
rowt.setEvent("oncontextmenu", function(event){this.action("menu")});
grid.setTemplate('row'rowt);
 
As expected the contextmenu appears when I right click while I'm over a row.

Now the same should happen if I right click in the lower half of the grid where no rows are shown.

What is the trick?

Thank you for helping.

Best regards.
Dietrich
Thursday, November 3, 2005
I found it myself:


Simple attach the event to the grid body by setting:


setEvent("oncontextmenu", function(event){alert('contextmenu');});
 
Setting

this.action("menu");  as Eventhandler does not work. The action "menu" is not fired for unknown reasons.
Dietrich
Thursday, November 3, 2005



This topic is archived.

Back to support forum

Forum search