1 Reply Latest reply on Aug 1, 2007 2:27 PM by batmitra

    Datagrid and Checkboxs

    GeorgeWS Level 1
      I have a Datagrid thats filled in by an ArrayCollection that comes from a remoteObject. There is one column that should have a checkbox. I have tried many many diffent suggestions to no avail. I need a working sample of a checkbox in a datagrid that when you scroll does not change the checkbox. Im using CF7 and Flex 2.01.

      CAN ANYONE HELP ME!!!!

      This is what it currently looks like:
      http://www.youngsmarket.com/youngsmarket/programs/national/nataccpro/bin/NatAccPro.html?Su pplierID=30

      When you scroll the checkboxs get messed up.

      This is my Checkbox part:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300">
      <mx:Script>
      <![CDATA[
      public var _sel:Boolean
      public var _ix:Number
      override public function set data(value:Object):void
      {
      _sel=value.data;
      _ix=value.idx
      cx.selected = _sel
      }
      ]]>
      </mx:Script>
      <mx:CheckBox id="cx" click="parentApplication.modifyData(_ix,cx.selected)"/>
      </mx:Canvas>

      This is my datagrid:
      <mx:DataGrid id="myDataGrid" dataProvider="{myAccounts}" width="100%" height="100%">
      <mx:columns>
      <mx:DataGridColumn dataField="Include"
      width="60" textAlign="center"
      headerText="Include"
      sortable="false"
      rendererIsEditor="true"
      editorDataField="selected">
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox horizontalAlign="center">
      <mx:Script>
      <![CDATA[
      [Bindable]
      public var selected:Boolean;
      ]]>
      </mx:Script>
      <mx:CheckBox id="displayCheckBox" selected="{data.Include}" click="selected = displayCheckBox.selected"/>
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn dataField="CAD105" headerText="DBA" minWidth="150"/>
      <mx:DataGridColumn dataField="CAD205" headerText="Address" minWidth="150"/>
      <mx:DataGridColumn dataField="CAD405" headerText="City" minWidth="100"/>
      <mx:DataGridColumn dataField="PCD105" headerText="Zip" minWidth="25"/>
      <mx:DataGridColumn dataField="STTX20" headerText="State" minWidth="25"/>
      <mx:DataGridColumn dataField="PHON05" headerText="Phone" minWidth="100"/>
      <mx:DataGridColumn dataField="SLMN20" headerText="Rep" minWidth="50"/>
      </mx:columns>
      </mx:DataGrid>

      Thanks
      George

      Sorry I will have to continue posting until I get an answer or figure it out.