The DataGrid is so amazing. I may be abusing it, yet I would like to display information to a user and let them update information. Ideally, I could call a Servlet on a Tomcat server.
My question is how can I tell which DataRows have been updated by the user. My hackneyed approach has been to try and clone a version of the original data, then I was going to compare the data before calling a httpservice. Unfortunately I haven't found a nice deep copy method to copy an array. Any pointer to an example for updating an editable datagrid, then calling a servlet (I've found many with the RemoteObject.) Here is an example below. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.collections.ICollectionView; public var unmodifiedDataProvider:Object = null; [Bindable] private var modifiableDataProvider:mx.collections.ICollectionView = null; private function initApp():void{ this.statesHttpService.send(); } private function stateModelResult(event:ResultEvent):void { try{ modifiableDataProvider = event.result.Requests.Request; unmodifiedDataProvider = new Object(); for (var i:int = 0; i < modifiableDataProvider.length; i++) { unmodifiedDataProvider[i] = modifiableDataProvider[i].valueOf(); //Any deep copy method would be immeasurably appreciated } } catch (err:Error) { unmodifiedDataProvider = null; modifiableDataProvider = null; this.updateLinkButton.enabled = false; } } private function updateInformation():void { var object:Object; for (var i:int = 0; i < modifiableDataProvider.length; i++) { object = modifiableDataProvider[i]; } } ]]> </mx:Script> <mx:HTTPService id="statesHttpService" method="get" url=" http://www.lifesabirch.org/target.xml" result="stateModelResult(event)" /> <mx:LinkButton x="463" y="85" id="updateLinkButton" label="Update" click="updateInformation()"/> <mx:DataGrid x="66" y="115" id="requestDataGrid" dataProvider="{modifiableDataProvider}" width="95%" height="95%" editable="true"> <mx:columns> <mx:DataGridColumn dataField="RequestID" headerText="Order Number" editable="false" /> <mx:DataGridColumn dataField="Target" headerText="Target" itemEditor="mx.controls.TextInput" editorDataField="text" editable="true" /> <mx:DataGridColumn dataField="Comments" headerText="Comments" itemEditor="mx.controls.TextInput" editorDataField="text" editable="true" /> </mx:columns> </mx:DataGrid> </mx:Application> -- ~~ http://www.lifesabirch.org