Thank you, Alex.
You've saved me on a few occasions now! J Thanks again, Bob From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Wednesday, October 31, 2007 11:18 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] datagrids and data changes You have to set editable=true on the DataGrid as well, otherwise the editing mode doesn't kick in. See how far that gets you. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ramsey, Robert L Sent: Wednesday, October 31, 2007 9:05 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] datagrids and data changes Thanks for all the information about the dataField and editorDataField properties, but I'm still screwing something up. The application is designed to let students decide if they want to tape a class or not(thus explaining some variable names). I have a very simplified version of the final app like this: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > <mx:HTTPService id="getClasses" method="POST" result="classesReturned(event)" contentType="application/x-www-form-urlencoded" url="https://www.myserver.edu/flexinterface.php" useProxy="false" > <mx:request xmlns=""> <command>getClasses</command> <tapefulldate>{tapeDate.selectedDate.toDateString()}</tapefulldate> <student>bob</student> </mx:request> </mx:HTTPService> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.Fault; import mx.controls.Alert; import mx.collections.*; [Bindable] public var offeredCourses:ArrayCollection = new ArrayCollection(); private function classesReturned(event:ResultEvent):void { try { offeredCourses = event.result.classes.myclass; } catch(e:ErrorEvent) { Alert.show(e.toString()); } } private function testfunc():void { var msg:String = ""; for (var it:Number=0; it<offeredCourses.length; it++) { msg += offeredCourses[it].tape + "\n"; } Alert.show(msg); } ]]> </mx:Script> <mx:DateField x="222" y="116" id="tapeDate" change="getClasses.send()"/> <mx:DataGrid y="150" dataProvider="{offeredCourses}" id="dgCourses" left="10"> <mx:columns> <mx:DataGridColumn headerText="Tape" dataField="tape" width="40" editable="true" rendererIsEditor="true" editorDataField="selected" itemRenderer="mx.controls.CheckBox" /> </mx:columns> </mx:DataGrid> <mx:Button x="51" y="369" label="Button" click="testfunc()"/> </mx:Application> What happens is that a student selects a date and the httpservice looks up that date in the database and returns a list of tapable classes. Student checks a box to indicate a class should be taped. Right now, if I click the button after checking some boxes, they still show up as false even though I can see the boxes are checked in the datagrid. I had also thought about using event handling on the clicks, but I thought I would do the comparison on the submit in case people misclicked or changed their mind before submitting. Then I wouldn't be handling two different events that simply cancelled each other out. I know I have a bad habit of selecting text as I read of clicking and unclicking buttons as I scroll. J Can anyone remind me of the syntax to loop through the datagrid itself, not the arraycollection? Thanks for the responses! Bob From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Melby Sent: Wednesday, October 31, 2007 9:15 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] datagrids and data changes I believe you need to include dataField and editorDataField on your column definition. For instance dataField="myBooleanProperty" editorDataField="selected" This should end up setting the "myBooleanProperty" property of the object in your data provider to the checkbox.selected state whenever it is changed. hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com Ramsey, Robert L wrote: Hi, I have the feeling I'm being very stupid about something, but here goes. I have a datagrid, myDatagrid, bound to a dataprovider, myData. myData is an ArrayCollection based on an xml list of data returned from a php script with an httpservice call, but I don't think that should make a difference. Right now, the data is one column that is a checkbox. By default, the checkbox value is set to false. If I click a checkbox and then iterate through myData, myData doesn't reflect the change to the data. Some of the things I was reading seemed to suggest that myData should immediately reflect the changes made to the data presented by myDatagrid. I'm not sure that should be true since it was only a one way binding from myData -> myDatagrid. My ultimate goal is that when the user clicks the submit button, I get only the records in myDatagrid that have changed. By the time the app is done there may be hundreds of rows of records with up to 10 fields. If I have to build the iteration, that's fine, but I'm also not seeing how to iterate through myDatagrid. Ideally, myDatagrid[rownumber][columned] would be great, but reading through the help I can't see what property of the datagrid let's me access the array of data. Thanks for any suggestions you can give me! Bob ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Even a man who is pure in heart and says his prayers by night may become a wolf when the wolfbane blooms and the autumn moon is bright. Maleva (Maria Ouspenskaya) The Wolf Man ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~