Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#6810 closed enhancement (worksforme)

Please provide a mechanism to allow a dijit.Menu context menu to be opened only over actual data rows

Reported by: guest Owned by: sorvell
Priority: high Milestone: 1.2
Component: DojoX Grid Version: 1.1.0
Keywords: Cc: yatessc@…
Blocked By: Blocking:

Description

dijit.Menu context menus are designed to be bound to specific DOM nodes either in the declaration, or via the Menu's bindDomNode() method. There does not appear to be a <div> or other DOM node with a fixed id in Grid which represents only the actual data rows, and excludes the scrollbars and any blank area below the rows if the data is not enough to fill the Grid's display area. This means that you end up displaying a context menu that is only valid if a specific row was clicked in those other locations as well, and there is no way within Menu to change its contents based on the event's contents/location before it is already open.

Obviously various workarounds are available - I have adopted one where I call the Menu's _openMyself() method directly from the Grid's onRowContextMenu handler, rather than binding it, but this has the disadvantages that it is calling an internal method, and that it breaks the Menu's keyboard accessibility features. It would also be possible to build a custom dijit based on Menu, but this seems excessive for what should be a simple task.

Change History (2)

comment:1 Changed 11 years ago by Nathan Toone

Resolution: worksforme
Status: newclosed

You could try and bind to the view's contentNode (which is the content of the rows, excluding the scroll bars - but could extend outside the visible area of the grid), or to the view's scrollboxNode (which is the "viewport" into the grid - and includes the scroll bars).

The way the grid is designed, those are the only two dom nodes that are attachable. The scrollboxNode is kind of like a "cookie cutter" that only displays a portion of the contentNode - which "slides" around underneath to only show particular portions.

You can access those nodes through grid.views.views[idx].scrollboxNode or grid.views.views[idx].contentNode - where idx is the 0-based index of the view you want to bind to.

You could also bind to grid.viewsNode - which is the top-level container for all views in the grid - but I'm guessing that's not what you are looking for.

I'm closing this for now - if you would like to reopen it with an example we could look at, there might be a better way to achieve what you are trying to do.

comment:2 Changed 11 years ago by bill

Milestone: 1.2

marking tickets closed in the last three months w/blank milestone to milestone 1.2.

Note: See TracTickets for help on using tickets.