[Dojo-interest] 1.4.0 enhanced grid: how to get the selected row for a context menu?

Wei CDL Huang hwcdl at cn.ibm.com
Mon Jan 11 02:20:02 EST 2010


Hi Plotinus,

First, like base DataGrid, you can listen to the appropriate menu events 
to get details of the row/cell where the menu is triggered:

        dojo.connect(dijit.byId('myGrid'), 'onRowContextMenu', 
function(e){ 
                console.log('row index = ', e.rowIndex, ' col index = ', 
e.cellIndex);// more event information like e.rowNode, e.sourceView, 
e.cellNode, e.cell etc.
        });

Similarly to know which row is clicked, you can listen to the appropriate 
events like 'onRowClick':
 
        dojo.connect(dijit.byId('myGrid'), 'onRowClick', function(e){ 
                console.log('row index = ', e.rowIndex, ' col index = ', 
e.cellIndex);// more event information like e.rowNode, e.sourceView, 
e.cellNode, e.cell etc.
        });

Regarding grid.focus.rowIndex, it indicates the current row index where 
the keyboard focus is, though not ideally, you can also get corresponding 
row index as you wanted.

- Evan

-------------------------------------------

Is it ok to use grid.focus.rowIndex?


Plotinus wrote:
> 
> First of all, Happy New Year!!! =)
> I've created an enhanced grid (dojo version 1.4.0) with a context 
rowMenu
> plugin. I don't  know how to get the row id when I click on the row.
> Any help will be appreciated.
> Thanks in advance,
> Plotinus
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20100111/5ac131eb/attachment.htm 


More information about the Dojo-interest mailing list