1 Reply Latest reply on Aug 5, 2009 1:41 AM by megharajdeepak

    Problem with Checkbox ItemRenderer in a DataGrid

    megharajdeepak Level 1

      Hello Everyone,


      I'm using a datagrid with two columns, which is used as a data entry grid. The first column has a simple text input field and the 2nd column has a checkbox as an itemrenderer. On creationComplete event, I'm passing an arraycollection as the dataprovider for this datagrid. The arraycollection:


      <mx:ArrayCollection id="psAC">
                      <mx:Object PaText="line1" PaCheckbox="0" />
                      <mx:Object PaText="line2" PaCheckbox="0" />
                      <mx:Object PaText="line3" PaCheckbox="1" />
                      <mx:Object PaText="line4" PaCheckbox="0" />
                      <mx:Object PaText="line5" PaCheckbox="0" />


      There is a datagrid (dGa) in the main application. On click of this, a pop up window comes up which has the same datagrid layout(i.e, 2 columns). And this is where the data is entered. Here, if the user checks the check box, I have assigned a value of '1' for the 2nd column of the arraycollection. THis code(below) works fine.


      <datagrid in pop up window>

      <mx:DataGridColumn headerText="Best Possible Action?" textAlign="center" width="200" editable="false">



                                                           override public function set data(value:Object):void{


                                                               if(value.PaCheckbox == 1){
                                                                  this.selected = true;
                                                                  this.selected = false;
                                                      if(this.selected == true){
                                                           data.PaCheckbox = 1;
                                                           data.PaCheckbox = 0;



      But I would also need to set the PaCheckbox value to 0 or 1, based on teh check condition of the check box. I tried using change event (commented in the code above). But there I get an error: Cannot access a property or method of a null object reference. I checekd in debug mode, there the data object is null! Can you please help me on how to pass back the values(0 o 1) to my arraycollection, based on the checkbox's status?