Quantcast

Creating 2 seperate menus on a dGrid tree

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating 2 seperate menus on a dGrid tree

Harry Devine
I have a dGrid using the Tree mixin.  I'm on version 0.3.16 currently.  I can create a menu by listening for the .dgrid-row:contextmenu event and display the menu.  However, I would like to have 1 menu displayed when the user clicks on a parent node of the tree, and a separate menu displayed on a child node click.  I'm not sure how to accomplish this.  Here's how I'm making the menu currently:

var activeItem;


grid.on(".dgrid-row:contextmenu", function(evt){
  evt.preventDefault(); // prevent default browser context menu
  row = grid.row(evt);
  mod.activeItem = row && row.data;
  });


var menu = new Menu({
  targetNodeIds: [grid.domNode]
});


menu.addChild(new MenuItem({
  label: "Remove",
  iconClass: "delete",
  onClick: function() {
  if (mod.activeItem) {
      console.log("Clicked on ", mod.activeItem);
    }
  } 
}));


Any thoughts?


Thanks,

Harry


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...