Hello - I have some design constraints which is forcing me to use an Array behind the scenes for updating a dataGrid. In either case, I have a simpler version of the code here, that basically follows an example in the docs except that the update is made directly to the array rather than using the suggested addItemAt(), setItemAt() methods.
I have confirmed that addItemAt and setItemAt do cause the dataGrid to redraw, however, I need to find what event I need to trigger and/or listen for to get the redraw to work if I am updating the array myself. See the following code: [---START CODE---] <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundAlpha="0" initialize="initImpl()"> <mx:Script> import mx.collections.ArrayCollection; [Bindable] public var employees:Array = new Array(); private function initImpl():void { dg.dataProvider = new ArrayCollection(employees); } private function addRow():void { if (frmName.text != "") { employees[employees.length] = {name: frmName.text, email: email.text, phone: phone.text}; } } private function updateRow():void { if (dg.selectedIndex != -1) { employees[dg.selectedIndex] = {name: frmName.text, email: email.text, phone: phone.text}; } } </mx:Script> <mx:HBox width="100%" height="100%"> <mx:DataGrid id="dg" width="100%" height="100%"> <mx:columns> <mx:Array> <mx:DataGridColumn dataField="name" headerText="Name"/> <mx:DataGridColumn dataField="phone" headerText="Phone"/> <mx:DataGridColumn dataField="email" headerText="Email"/> </mx:Array> </mx:columns> </mx:DataGrid> <mx:Form width="100%" height="100%"> <mx:FormItem label="Name"> <mx:TextInput id="frmName" width="200" text="{dg.selectedItem.name}"/> </mx:FormItem> <mx:FormItem label="Email"> <mx:TextInput id="email" width="200" text="{dg.selectedItem.email}"/> </mx:FormItem> <mx:FormItem label="Phone"> <mx:TextInput id="phone" width="200" text="{dg.selectedItem.phone}"/> </mx:FormItem> <mx:FormItem> <mx:HBox> <mx:Button label="Update" click="updateRow()"/> <mx:Button label="Add" click="addRow()"/> </mx:HBox> </mx:FormItem> </mx:Form> </mx:HBox> </mx:Application> [---END CODE---] I've tried listening for collection events and calling invalidateDisplayList(), but that doesn't seem to work. Any other ideas? Thanks, -scott ------------------------ Yahoo! Groups Sponsor --------------------~--> Get to your groups with one click. Know instantly when new email arrives http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/