0 Replies Latest reply on Oct 2, 2009 2:03 PM by Ganeshsrivatsav

    Get Specific cell data using row and column indexes

    Ganeshsrivatsav

      Hi all,

       

      I am trying to get a specific cell data based on rowindex and column index like this

       

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      mx.events.ListEvent;

       

       

      public function itemClickEvent(event:ListEvent):void

      {

      clickColumn.text=String(event.columnIndex);

      clickRow.text=String(event.rowIndex);

      eventType.text=mygrid.dataProvider.getItemAt(clickRow)[clickColumn];

       

      }

      ]]>

       

       

      </mx:Script>

       

      <mx:DataGrid

       

      x="10" y="8" width="528" dataProvider="{MAIN01.dataProvider}" height="185" itemClick="itemClickEvent(event);" draggableColumns="true" id="mygrid">

       

      <mx:columns>

       

      <mx:DataGridColumn headerText="CLASS TYPE" dataField="CLASSTYPE"/>

       

      <mx:DataGridColumn headerText="YEARF" dataField="YEARF"/>

       

      <mx:DataGridColumn headerText="CLASS VALUE" dataField="CLASSVALUE"/>

       

      <mx:DataGridColumn headerText="PRODUCT" dataField="PRODUCT"/>

       

       

      </mx:columns>

       

      </mx:DataGrid>

       

       

       

       

       

       

       

       

       

       

      <mx:Form>

       

       

      <mx:FormItem label="Column Index:"

      >

       

       

      <mx:Label id="clickColumn"/>

       

       

      </mx:FormItem>

       

       

      <mx:FormItem label="Row Index:"

      >

       

       

      <mx:Label id="clickRow"/>

       

       

      </mx:FormItem>

       

       

      <mx:FormItem label="Type:"

      >

       

       

      <mx:Label id="eventType"/>

       

       

      </mx:FormItem>

       

      </mx:Form>

       

      I dont want to hardcode the column name instead of columnindex because I want to capture where ever you click independent of column.

       

      Now,

       

      when I click on a cell I am getting rowindex and columnindex but I am not getting the text for eventType which is the getitemAt()

       

      Please help me If I am doing anything wrong.

       

      Regards,

       

      Ganesh