How about just:

<mx:DataGrid>
<mx:columns>
<mx:DataGridColumn headerText="Check Something" editable="true">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selected="[EMAIL PROTECTED]'true'}"
click="[EMAIL PROTECTED](event.target as CheckBox).selected" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>

Dale


--- In flexcoders@yahoogroups.com, "Cato Paus" <[EMAIL PROTECTED]> wrote:
>
> 
> package {
> 
> import flash.display.DisplayObject;
> 
> import flash.events.KeyboardEvent;
> 
> import flash.events.MouseEvent;
> 
> import flash.text.TextField;
> 
> import mx.controls.CheckBox;
> 
> import mx.controls.dataGridClasses.DataGridListData;
> 
> import mx.controls.listClasses.ListBase;
> 
> 
> 
> /**
> 
> * The Renderer.
> 
> */
> 
> public class TaskActive extends CheckBox
> 
> {
> 
> 
> 
> public function TaskActive()
> 
> {
> 
> focusEnabled = false;
> 
> invalidateDisplayList();
> 
> }
> 
> 
> 
> // update data item on click
> 
> 
> 
> // TODO: Validate taskVO
> 
> //and send update to db.
> 
> 
> 
> override protected function clickHandler(event:MouseEvent):void
> 
> {
> 
> super.clickHandler(event);
> 
> data[DataGridListData(listData).dataField] = selected;
> 
> }
> 
> 
> 
> // center the checkbox icon
> 
> override protected function updateDisplayList(w:Number, h:Number):void
> 
> {
> 
> super.updateDisplayList(w, h);
> 
> 
> 
> var n:int = numChildren;
> 
> for (var i:int = 0; i <n; i++)
> 
> {
> 
> var c:DisplayObject = getChildAt(i);
> 
> // CheckBox component is made up of box skin and label TextField
> 
> if (!(c is TextField))
> 
> {
> 
> c.x = Math.round((w - c.width) / 2);
> 
> c.y = Math.round((h - c.height) / 2);
> 
> }
> 
> }
> 
> }
> 
> }
> 
> }
> 
> bump the file in root of app,
> 
> and here is some good reading :)
> 
> http://weblogs.macromedia.com/pent/
> <http://weblogs.macromedia.com/pent/>
> 
>
http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.ht\
> ml
>
<http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.h\
> tml>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Laila Towailib" <layla.towailib@>
> wrote:
> >
> > ---------- Forwarded message ----------
> > From: Laila Towailib layla.towailib@
> > Date: Sat, May 31, 2008 at 8:37 PM
> > Subject: dataGrid and checkBox
> > To: flexcoders@yahoogroups.com
> >
> >
> > *what is the best way to add a checkbox field to each row of a
> datagrid and
> > read what is checked ?
> > I really need this for my project.*
> >
>


Reply via email to