1 Reply Latest reply on Feb 28, 2008 4:44 AM by SujitG

    CheckBoxes

    kilyas2007 Level 1
      I am rendering some data using checkBoxes. The code has been posted below. The checkBoxes are displayed checked or unchecked based on the line

      editorDataField="selected"

      But using selected or unselected here checks or unchecks the whole list. I want to use some decision making here, based on which some of the checkboxes would appear checked and some would be unchecked. I have however failed to find an option ot do it. Any advise help would be welcome. Again I don't want to check or unchesk al the boxes but use some decision making to check a few and uncheck a few at intial rendering.

      <?xml version="1.0"?>
      <!-- itemRenderers\inline\CBInlineCellEditor.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;

      [Bindable]
      private var myDP:ArrayCollection = new ArrayCollection([
      {label1:"Order #2314", contact:"John Doe",
      quant:3, solddate:new Date(2005, 0, 1), Sent:true},
      {label1:"Order #2315", contact:"Jane Doe",
      quant:3, solddate:new Date(2005, 0, 5), Sent:false}
      ]);
      private function checkCheck(e:Event):void {
      trace("edited");

      }

      ]]>
      </mx:Script>

      <mx:DataGrid id="myDG" dataProvider="{myDP}" variableRowHeight="true" itemEditEnd="checkCheck(event)"
      width="500" height="250" editable="true">
      <mx:columns>
      <mx:DataGridColumn dataField="label1" headerText="Pod Id" editable="false"/>
      <mx:DataGridColumn dataField="quant" headerText="Pod Name" editable = "false"
      itemEditor="mx.controls.NumericStepper" editorDataField="value"/>

      <mx:DataGridColumn dataField="Visible" itemRenderer="mx.controls.CheckBox" rendererIsEditor="true"
      editable = "false" editorDataField="selected"/>
      </mx:columns >
      </mx:DataGrid>
      </mx:Application>