4 Replies Latest reply on Apr 27, 2010 9:32 AM by asafdsadfasddfsas

    Simple Datagrid Question

    playwiz Level 1

          Hey guys!  Here's my question:  I want to know how I can get a specific column value of a datagrid selected by the mouse as opposed to the entire row.  My goal is to have a picture displayed onMouseOver depending on which item the mouse is on.



        • 1. Re: Simple Datagrid Question
          asafdsadfasddfsas Level 1

          You need to have a event handler for ListEvent.


          The ListEvent dispatched by the datagrid will have the following properties:






          public function itemRollOverFunction(le:ListEvent):void{



          <mx:DataGrid itemRollOver="itemRollOverFunction(event)"/>


          Hope it helps.




          • 2. Re: Simple Datagrid Question
            Matt Le Fevre Level 4

            had this test app i made a while back lying around, should get you started


            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="top"
                horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" viewSourceURL="srcview/index.html">
                <mx:XMLList id="employees">
                        <name>Test Test</name>
                        import mx.events.ListEvent;
                        private function doThis(event:ListEvent):void
                            dg.selectedIndex = event.rowIndex;
                <mx:DataGrid id="dg" color="0x323232" width="675" itemRollOver="doThis(event)" rowCount="3" dataProvider="{employees}" x="14" y="62">
                        <mx:DataGridColumn dataField="name" headerText="Item 1"/>
                        <mx:DataGridColumn dataField="phone" headerText="Item 2"/>
                <mx:Image id="img1" x="162" y="201" width="377" height="269" scaleContent="true" source="{dg.selectedItem.image}"/>  
            1 person found this helpful
            • 3. Re: Simple Datagrid Question
              playwiz Level 1

              Wow, you guys are awesome!  Thanks!!   And Sathish: thanks for spending your first post to answer my question -- makes me feel special.

              • 4. Re: Simple Datagrid Question
                asafdsadfasddfsas Level 1



                it's my pleasure. This is my first day here. I am enjoying it.