I ran into the same issue a while back, but it's actually expected functionality. The "change" event is only triggered upon user interaction, not scripting.
Matt Chotin's reply was: --- The valueCommit event will fire in this case, "change" is only when it was user-interaction that caused the selection, not programmatic changes. --- I didn't want to have two separate event handlers to handle each of these events, so I manually dispatched an event from the datagrid. Here is an example of working code. The "special" line of code is the one after /** DISPATCH CHANGE EVENT **/ Cheers, Adam <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"> <mx:Script> <![CDATA[ public function captureDatagridKey(event:KeyboardEvent):void { var a:Array,i:Number; if (event.ctrlKey && event.keyCode == 65){ var num:Number = event.target.dataProvider.length as Number; a = []; for (i=0;i<num;i++) a[i] = i; event.target.selectedIndices = a; /** DISPATCH CHANGE EVENT **/ event.target.dispatchEvent(new Event("change")); } } public function captureChangeEvent(event:Event):void { eventLog.text += "Change event captured\n"; } ]]> </mx:Script> <mx:XMLList id="employees"> <employee> <name>Christina Coenraets</name> <phone>555-219-2270</phone> <email>[EMAIL PROTECTED]</email> <active>true</active> </employee> <employee> <name>Joanne Wall</name> <phone>555-219-2012</phone> <email>[EMAIL PROTECTED]</email> <active>true</active> </employee> <employee> <name>Maurice Smith</name> <phone>555-219-2012</phone> <email>[EMAIL PROTECTED]</email> <active>false</active> </employee> <employee> <name>Mary Jones</name> <phone>555-219-2000</phone> <email>[EMAIL PROTECTED]</email> <active>true</active> </employee> </mx:XMLList> <mx:DataGrid keyDown="captureDatagridKey(event)" change="captureChangeEvent(event)" id="dg" width="100%" height="200" dataProvider="{employees}"> <mx:columns> <mx:DataGridColumn dataField="name" headerText="Name"/> <mx:DataGridColumn dataField="phone" headerText="Phone"/> <mx:DataGridColumn dataField="email" headerText="Email"/> </mx:columns> </mx:DataGrid> <mx:TextArea id="eventLog" width="100%" height="300" /> </mx:Application> ----- Original Message ----- From: Joe To: [email protected] Sent: Tuesday, November 28, 2006 9:09 AM Subject: [flexcoders] Newie : calling a function when setting selected index I have a datagrid with about 25 rows of employees names. On click or change I am calling a remote object that updated information based on the employee that you clicked. The row that was selected the disapears. I would like to know if it is possible to this with out using a click or change event. Can it automatically highlight a row and call the function and then go on to the next row and do the same. I know I can set the selected index, but it does seem to call the function. Any advice would be helpfull. Thank you.

