I've seen a few different approaches to the checkbox grid. Alex has a clean implementation, but without the select all header renderer. I believe Josh Tynjala has a few checkbox list components as well
http://www.zeuslabs.us/ My take on the checkbox datagrid with a header renderer can be found at http://www.thegoldhold.com/?p=4 Full source available if you want to hack on it for your own needs. On Fri, Apr 4, 2008 at 12:11 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > There are some headerRenderer examples on my blog ( > blogs.adobe.com/aharui). You have to subclass and override the data > setter and expect a DataGridColumn. The default code doesn't handle that. > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Myth Kumar > *Sent:* Friday, April 04, 2008 8:43 AM > *To:* flexcoders@yahoogroups.com > *Subject:* [flexcoders] Flex newbie stuck with DataGrid headerRenderer > > > > Hi Friends, > I have a DataGrid with the first column acting as a selection column, > where I've successfully rendered a Checkbox. Now I want to add a > toggle button to the headerRenderer such that toggling the button > would select/deselect all the checkboxes in the datagrid. > > For this, my code is something like this: > > <DataGrid id="dtaMats" width="100%" height="100%" > horizontalScrollPolicy="off"> > <columns> > <DataGridColumn headerText="Select" dataField="isSel" > width="40" textAlign="center" > headerRenderer="DataGridHeaderButton"> > <itemRenderer> > <Component> > <CheckBox selected="{data.isSel}" > click="{data.isSel=!data.isSel}"/> > </Component> > </itemRenderer> > </DataGridColumn> > <DataGridColumn headerText="Material" dataField="Matnr"/> > <DataGridColumn headerText="Plant" dataField="Werks"/> > <DataGridColumn headerText="Storage" dataField="Lgort"/> > </columns> > </DataGrid> > > I'm setting the dataProvider at runtime in the AS code, after getting > the data from the webservice. > > And my custom button header class is like this: > > package > { > import mx.controls.Button; > > public class DataGridHeaderButton extends Button > { > public function DataGridHeaderButton() > { > //TODO: implement function > super(); > super.toggle = true; > super.label = "Select All"; > } > } > } > > But I get an error: "ReferenceError: Error #1069: Property isSel not > found on mx.controls.dataGridClasses.DataGridColumn and there is no > default value." when I try to run this code. > It runs fine without the 'headerRenderer' property set, but errors > with it. > > Can you please suggest me how can I get around it? > Do I have to override some functions of the Button class? If yes which > ones would help me? > > >