Loading ...
Sorry, an error occurred while loading the content.

Re: ContextMenu and row selection in DataTable

Expand Messages
  • little_bobes
    Thanks, but I know how to select a row and how to implement the ContextMenu, what I need is: how to select row in the DataTable before the ContextMenu is
    Message 1 of 3 , Mar 3 4:09 AM
    • 0 Attachment
      Thanks, but I know how to select a row and how to implement the
      ContextMenu, what I need is: how to select row in the DataTable before
      the ContextMenu is fired.
      Fortunately, I found the solution:

      my.onContextMenuBeforeShowEvent = function() {
      var elRow = this.contextEventTarget;
      elRow = my.DataTable.getTrEl(elRow);
      my.DataTable.unselectAllRows();
      my.DataTable.selectRow(elRow);
      };

      my.ContextMenu.beforeShowEvent.subscribe(my.onContextMenuBeforeShowEvent);

      Bob

      > See:
      >
      > http://developer.yahoo.com/yui/datatable/#rowselect
      > http://developer.yahoo.com/yui/examples/datatable/dt_rowselect.html
      > http://developer.yahoo.com/yui/examples/datatable/dt_contextmenu.html
      >
      >
      > > I have a ContextMenu and a DataTable with a row selection.
      > > When I click right button on the DataTable, I need to select row in
      > > that DataTable before the ContextMenu is fired.
      > >
      > > Where and what should I do?
      > >
    Your message has been successfully submitted and would be delivered to recipients shortly.