_Natasha, can you help me on this?

I have new problem on the datagrid column. I need to create a check box on the second column and there are compile error saying that Access of undefined property cboActivities. See attached files for codes. Column one works fine.
thank you in advance.
Wendy

when there are values in "association" then the error occurs when I selected a ID in ComboBox. If There are not value to show in the datagrid, then no errors.
<mx:ComboBox 
id="cboActivities" prompt="Please select an activity ID" dataProvider="{activityXML}" labelField="@event_id" x="121" y="87">
</mx:ComboBox> 
<mx:DataGrid x="10" y="318" id="dgAssociation" dataProvider="{cboActivities.selectedItem.association}" columnWidth="100" height="100" editable="false" width="272">
      <mx:columns>
         <mx:DataGridColumn headerText="       Association      "
                        dataField="{'col1'+ cboActivities.selectedItem.@event_id}" id="dgcol1" />
        <mx:DataGridColumn editable="false"  headerText="  Attribute Gift  " id="dgcol2" >
        <mx:itemRenderer>
              <mx:Component> 
           <checkBoxItemRenderer:CBItemRenderer dataField="{'col2' + outerDocument.cboActivities.selectedItem.@event_id}" />                       
          </mx:Component>
        </mx:itemRenderer>   
      </mx:DataGridColumn>          
      </mx:columns>
   </mx:DataGrid>
below is the ItemRendere codes:
package  
import flash.events.Event; 
import flash.events.MouseEvent; 
import mx.controls.CheckBox; 
import mx.controls.DataGrid; 
import mx.controls.dataGridClasses.DataGridColumn; 
import mx.controls.listClasses.ListBase; 
import mx.events.FlexEvent; 
public class CBItemRenderer extends CheckBox{
private var _dataField:String; 
private var _enabledField:String; 
public function CBItemRenderer(){
super();setStyle(
"textAlign","center");}
override public function set data(value:Object):void { 
super.data = value;  
if (value != null) {  
if( _dataField == null ){ 
throw new Error("No data field");}
if(value.hasOwnProperty(_enabledField)){ 
this.enabled = data[_enabledField];}
override public function validateProperties():void{
super.validateProperties();selected = data[_dataField];
override protected function clickHandler(event:MouseEvent):void{
super.clickHandler(event);clickOpp();
public function set dataField(dataField:String):void{_dataField = dataField;
public function set enabledField(enabledField:String):void{_enabledField = enabledField;
private function clickOpp():void{ 
if(data.hasOwnProperty( _dataField ) && _dataField!=""){data[_dataField] = selected;
else if( !data.hasOwnProperty( _dataField ) && _dataField!="" ){
throw new Error("Data Field is not available in Data Object ");}
edu.yu.checkBoxItemrenderer{

Similar Messages

Maybe you are looking for