Flex Checkbox as Grid item editor and renderer
I have a dataGrid with a few columns that are simply check boxes. The kicker is I want the user to be able to edit those check boxes. So I knew the first step, using the renderer to have the data from the data provider show up in a check box, but I had to do some research for the editor part.
Here is the code snip of the DataGridColumn that should help you out if you were trying to do that same thing. (Warning: the textAlign property may only work in Flex 3).
The important part to this that I was missing is:
editorDataField="selected"
This returns the value of the 'selected' property to the data provider, otherwise, by default it looks to return the "text" property, which a check box does not have.
Hope that helps someone.
Here is the code snip of the DataGridColumn that should help you out if you were trying to do that same thing. (Warning: the textAlign property may only work in Flex 3).
<mx:DataGridColumn
dataField="isOpen"
headerText="Open"
editable="true"
textAlign="center"
itemEditor="mx.controls.CheckBox"
editorDataField="selected"
itemRenderer="mx.controls.CheckBox"/>
The important part to this that I was missing is:
editorDataField="selected"
This returns the value of the 'selected' property to the data provider, otherwise, by default it looks to return the "text" property, which a check box does not have.
Hope that helps someone.
Comments
-Samir