0 Replies Latest reply on Jul 18, 2007 6:59 PM by madman1

    Context menu in TreeNode, (oncontextmenu help)

    madman1 Newbie

      Sorry for my english.

      I'm trying to implement a contextMenu (rigth-click), on Tree nodes.

      I see the property "oncontextmenu", but I find a bit problem.

      With other onXXX (onClick, onMouseDown), I can do:

      onClick(myFunction(event)).......

      function myFunction(e){
      // e is a Event object

      }

      I need get, the Event object because, I would like to do, something like this:


      <rich:treeNode type="organism" oncontextmenu="showFileContextMenu(event); return false;">
      ............
       </rich:treeNode>



      function showFileContextMenu(e){
       var left = Event.pointerX(e)+'px';
       var top = Event.pointerY(e)+'px';
       var element = $('menu'); // div with the UI menu
       element.setStyle({left: left, top: top, position: 'absolute'});
       $('menu').show();
       //Event.stop(e);
      }
      


      But I get an error in : showFileContextMenu(event)
      event is undefined, don't exist.

      How can I do something similar?