You need to study up on item renderers a bit.  What you are trying to do
will not work.  The check box state must be driven by a value in the
dataProvider item.  You should not attempt to access the check box directly
via code.

 

Find an example of a checkbox renderer, there are many, I have one on
www.cflex.net <http://www.cflex.net/> .  Do not attempt to create an
interactive itemRenderer from scratch

 

When you have a working renderer, you can simply set the property on the
dataProvider item (using the collection API, or itemUpdated())

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of fumeng5
Sent: Tuesday, April 14, 2009 9:56 AM
To: [email protected]
Subject: [flexcoders] Access DataGridColumn on DataGrid Row Click

 






Hi,

I'm trying to access a DataGridColumn when a user clicks on a DataGrid row.
The problem is that I'm not trying to access the column that was clicked
on....

I want to select a checkbox that is always in the 2nd column whether a user
clicks on the 2nd column or not. I'm having trouble figuring out how to do
that......Can anyone point me in the right direction?

Thanks!

<mx:DataGrid id="myDG" width="100%" height="100%"
itemClick="onItemClick(event)">

<mx:dataProvider>
<mx:XMLListCollection>
<mx:source>
<mx:XMLList xmlns="">
<data col1="haha" col2=""/>
<data col1="hahaha" col2=""/>
<data col1="hahahaha" col2=""/>
</mx:XMLList>
</mx:source>
</mx:XMLListCollection>
</mx:dataProvider>

<mx:columns>

<mx:DataGridColumn headerText="col1" dataField="@col1"/>

<mx:DataGridColumn headerText="col2" dataField="@col2">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox label="Check this Box!" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

</mx:columns>

</mx:DataGrid>



Reply via email to