Hi Scott,

I tried your suggestion and in my handleMenuSelectEvent, I do:

var dataGrid:DataGrid = event.contextMenuOwner as DataGrid;
dataGrid.selectedIdex = (event.mouseTarget as
DataGridItemRenderer).listData.rowIndex - 1;

but this solution does not always work, because event.mouseTarget does
not always return a DataGridItemRenderer, it somes return a
ListBaseContentHolder, in which case the above code would not work.

Are you getting the index of the row being clicked from somewhere
else?  Thanks.

Ban

--- In [email protected], Scott Melby <[EMAIL PROTECTED]> wrote:
>
> I did it by listening for the MENU_SELECT event on my context menu... 
> works great.
> 
> _myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, 
> handleMenuSelectEvent, false, 0, true);
> 
> hth
> Scott
> 
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com
> 
> 
> 
> Alex Harui wrote:
> >
> > Search the archives for right-click.  I think it has been done before.
> >
> >  
> >
> >
------------------------------------------------------------------------
> >
> > *From:* [email protected]
[mailto:[EMAIL PROTECTED] 
> > *On Behalf Of *letterpigeon
> > *Sent:* Wednesday, December 12, 2007 7:57 AM
> > *To:* [email protected]
> > *Subject:* [flexcoders] Datagrid context menu question
> >
> >  
> >
> > Hi,
> >
> > I have a datagrid with a context menu. when user right click on the
> > grid, is there a way to tell which row that just get right clicked
> > (not the current selected item and right clicking on the grid doesn't
> > change the selected item). Just want to make the UI a bit more
> > intuitive (instead of making to user to left click on an item, then
> > right clicking again to action on the desired row).
> >
> > Thanks.
> >
> >
>


Reply via email to