Best practice in a case like this is to have the renderer update a property on the dataProvider item with the selected state of the checkbox. Then you loop over the dataProvider selecting the items based on the updated property value.
You cannot use the selected state of the visual components themselves. In fact, you will see tht what you have will fail when you fill the datagrid up and need to scoll. Your rendrer must use the value of the data property to set the seleted state of the checkbox. You will find many examples and further explananation if you search for: item renderer recycle. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Vega Sent: Sunday, December 07, 2008 6:18 PM To: [email protected] Subject: [flexcoders] Selected Items in a datagrid I have a datagrid with a custom renderer for the id column. What I want to accomplish is letting the user select as many rows as they want by clicking on the checkbox in the first column. When they click the export button I will do some logic to export only the selected records to a txt file. Going by the solution below how can i figure out what indexes are selected? Even if i can't easily get a list of all the id's I can run over the index list and get the actuall id's. If there is a better way to do this and I am going about this the wrong way please speak up! Thanks in advance! <mx:DataGrid id="contacts" width="100%" height="100%" dataProvider="{_data}"> <mx:columns> <mx:DataGridColumn dataField="id" headerText="Select" width="40" textAlign="center"> <mx:itemRenderer> <mx:Component> <mx:CheckBox click=""/> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> <mx:DataGridColumn dataField="companyName" headerText="Company"/> <mx:DataGridColumn dataField="firstName" headerText="First Name"/> <mx:DataGridColumn dataField="lastName" headerText="Last Name"/> <mx:DataGridColumn dataField="city" headerText="City"/> <mx:DataGridColumn dataField="state" headerText="State"/> </mx:columns> </mx:DataGrid> Thank You Dan Vega [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> http://www.danvega.org <http://www.danvega.org>

