views:

196

answers:

2

I'm using Dojo 1.4.

Given a dojox.grid.DataGrid in markup:

<table jsId="grid1" dojoType="dojox.grid.DataGrid" 
       structure="layout"
       delayScroll="true" 
       columnReordering="true" 
       selectable="true"
       onRowDblClick="onRowDblClick"
       onRowContextMenu="onRowContextMenu"
       headerMenu="grid1_headerMenu"
       >
  <div dojoType="dijit.Menu" id="grid1_rowMenu" jsId="grid1_rowMenu" style="display: none;">
    <div dojoType="dijit.MenuItem" onClick="gridRowContextMenu_onClick">Edit</div>
  </div>
</table>

I haven't found a better way to show grid's contex menu that this one:

function onRowContextMenu(e) {
       grid1_rowMenu.bindDomNode(e.grid.domNode);
}

It works, menu pops up and function 'gridRowContextMenu_onClick' has being called.

function gridRowContextMenu_onClick(e) {
  // how to get a row data???
}

My question is how inside menuitem's onClick handler (gridRowContextMenu_onClick) can I get original row for which menu was poped up?

A: 

Did you try e.rowIndex?

StanislavL
A: 

var item = e.grid.getItem(e.rowIndex);

rika_t