Hi Jeff,

Thank you very much for the help and the code. That helped me a lot in
understanding getColumnAt() and getItemAt(). Thanks agin.

Thanks!
Hari

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jeff tapper
Sent: Tuesday, May 24, 2005 11:55 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] how to get value from datagrid cell?

ok, try this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
creationComplete="initApp()">
<mx:Script>
<![CDATA[
var schedAdj_do:Array;
function initApp(){
         var item1:Object = new Object();
         item1.name = "Jeff";
         item1.company="Tapper.net";
         var item2:Object = new Object();
         item2.name = "Lisa";
         item2.company="LKJ Hosting";
         schedAdj_do=new Array(item1,item2);

}
function setData(event:Object){
         var col:String= 
event.target.getColumnAt(event.columnIndex).columnName;
         var row:Number = event.itemIndex;
      mx.controls.Alert.show("event.oldValue : 
"+event.oldValue+newline+"new value : "+event.target.getItemAt(row)[col]);
}
]]>
</mx:Script>
<mx:DataGrid id="myDataGrid" width="100%" dataProvider="{schedAdj_do}" 
textAlign="left" height="250" headerHeight="50" editable="true" 
cellEdit="setData(event)"/>

</mx:Application>

At 10:32 AM 5/24/2005, you wrote:
><mx:DataGrid id="myDataGrid" width="100%" dataProvider="{schedAdj_do}"
>textAlign="left" height="250" headerHeight="50" editable="true"
>cellEdit="setData(event)">
>........
></mx:DataGrid>
>
>function setData(event:Object)
>       {
>
>             mx.controls.Alert.show("column Name :
>"+myDataGrid.getColumnAt(event.columnIndex).columnName);
>             mx.controls.Alert.show("event.oldValue : "+event.oldValue+"
>new value : "+myDataGrid.getColumnAt(event.columnIndex).value);
>             //myDataGrid.editField( event.columnIndex, colName: String,
>data);
>       }



 
Yahoo! Groups Links



 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to