Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Context click on disabled row not working

    I added a FolderContextClickHandler to a TreeGrid to show a context menu that has menu items to select/deselect children nodes. I also call event.cancel() in a CellContextClickHandler to disable the default browser context menu.

    I then enable and disable certain nodes based some business logic. This is done so users can only click on the checkbox of certain nodes.

    Now when I right-click on enabled nodes, my context menu appears correctly. However, on disabled nodes, the default browser menu (I'm using Firefox 7) appears.

    I tried playing with different context click and mouse up/down handlers and I figured out that adding a ShowContextMenuHandler worked. However, the event in that handler does not have access to the record under the cursor. Is there a way to get the record so I can select/deselect its children? Or is there a different way to accomplish what I'm trying to do (e.g., add a different handler)?

    Using SmartGWT 2.5p.

    #2
    Disabled really means disabled - non-interactive. That's why we don't show the context menu.

    Using the (lower-level) ShowContextMenuHandler is a reasonable way to make this specific interaction work despite the record's disabled state, and you can easily get the rowNum under the mouse with getEventRow().

    Comment


      #3
      There wasn't a ShowContextMenuEvent.getEventRow() but I figured that you meant to say, use the ListGrid.getEventRow()

      I removed the FolderContextClickHandler and just used the ShowContextMenuHandler to call Menu.showContextMenu, which I overrode showContextMenu to put the logic that uses ListGrid.getEventRow() to see if the record under the cursor was a folder or not and then select/deselect its children.

      Thanks!

      Comment

      Working...
      X