This might help you.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">

        <mx:Script>
                <![CDATA[
                        import mx.controls.dataGridClasses.DataGridColumn;
                        import mx.controls.dataGridClasses.DataGridItemRenderer;
                        import mx.events.DataGridEvent;
                        import mx.events.ListEvent;
                        import mx.controls.Alert;



                        private function rightClick(e:MouseEvent):void{

                                if(e.target as DataGridItemRenderer){
                                var dgp:DataGridItemRenderer= e.target as  
DataGridItemRenderer;
                                var index:int = dgrid.itemRendererToIndex(dgp);

                                //trace(e.currentTarget ,e.target);
                                Alert.show(index.toString());
                }
                        }


                ]]>
        </mx:Script>

        <mx:DataGrid id="dgrid" width="100%" height="100%"
rightClick="rightClick(event)">
                <mx:ArrayCollection id="coll">
         <mx:Object>
            <mx:Artist>Ryan</mx:Artist>
            <mx:Price>11.00</mx:Price>
            <mx:Album>Slanted and Fainted</mx:Album>
         </mx:Object>
         <mx:Object>
            <mx:Artist>Remarks</mx:Artist>
            <mx:Album>Brighten the Future</mx:Album>
            <mx:Price>11.99</mx:Price>
         </mx:Object>
      </mx:ArrayCollection>

        </mx:DataGrid>
</mx:WindowedApplication>



On Apr 12, 12:14 pm, nd <[email protected]> wrote:
> Hi All,
>
> I have a datagrid with some columns and multiple rows. When i right
> click on one particular row, I want to make that particular row
> selected and get the Index of the selected row.
>
> Can you please tell me how to go about this.
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to