Maybe:

override public function set data(value:Object):void
{
if(value != null)
{
super.data = value;
selected = ( value.label == "true" ? true: false);
}


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
markgoldin_2000
Sent: Friday, October 31, 2008 3:35 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Center Checkbox in DG Column


I dont know what I am missing, but still not working for me.
Here is my code:
import flash.events.Event;

import mx.controls.*;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.controls.listClasses.IDropInListItemRenderer;
public class checkBoxGrid extends CheckBox implements
IDropInListItemRenderer
{
public function checkBoxGrid()
{
super();
addEventListener("change", onClick);

}

override public function set data(value:Object):void
{
if(value != null)
{
super.data = value;
selected = value.label;
}

}

//called by click of the checkbox
private function onClick(e:Event):void
{
var dataFieldName:String = DataGrid
(listData.owner).columns[listData.columnIndex].dataField;
data[dataFieldName] = String
(selected); //set the checkbox state into the dataProvider

}
}

mxml implementation:
<mx:DataGridColumn headerText="Include into Report"
dataField="includeintoreport" width="40"
textAlign="center">
<mx:itemRenderer>
<mx:Component>
<modulecode:checkBoxGrid/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

Data sample: Fragment
vendors>
<ccompany>
A. FEIBUSCH CORP.
</ccompany>
<includeintoreport>
false
</includeintoreport>
<cvendno>
ZIPPER
</cvendno>
</vendors>

When I run it all chckboxes come checked despite false in
includeintoreport field. So, when I click on a checkbox nothing is
changed, it keeps checked status.

Hope, someone can help.

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui <[EMAIL PROTECTED]> wrote:
>
> Also see:
http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.h
tml
>
> From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On 
Behalf Of markgoldin_2000
> Sent: Friday, October 31, 2008 1:50 PM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Center Checkbox in DG Column
>
>
> <You could also potentially use my extended datagrid
> Where can I find it?
>
> --- In 
> flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%
40yahoogroups.com>, "Amy" <amyblankenship@> wrote:
> >
> > --- In 
> > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%
40yahoogroups.com>, "markgoldin_2000"
> > <markgoldin_2000@> wrote:
> > >
> > > I am trying to get a checkbox working properly in my DG column
> when
> > > it's placed in a HBox in order to center the checkbox.
> > > I am overriding a few functions in the checkbox but none of them
> gets
> > > any hit. Do I need also override something in the HBox
container?
> >
> > You might find this useful:
> > http://www.returnundefined.com/2006/11/creating-truly-reusable-
> > renderers-with-classfactory
> >
> > You could also potentially use my extended datagrid to set the
> > verticalCenter and horizontalCenter on the checkboxes to 0. In
> that
> > case, you could simply use a CheckBox as the itemRenderer. Or, if
> > you're only using CheckBoxes in that one place, you could just use
> a
> > CheckBox TypeSelector to set the horizontalCenter and
> verticalCenter
> > styles.
> >
> > HTH;
> >
> > Amy
> >
>

Reply via email to