0 Replies Latest reply on Mar 25, 2008 7:16 AM by P Steven

    Retrieving values of checkboxes in repeated datagrid

    P Steven Level 1
      I could really do with some help on this!

      Basically I have a repeated custom component. The custom component is basically just a text title and a datagrid.

      The datagrid has 2 columns, the first being just a line of text and the second a checkbox

      The number of rows of data varies for each repeated occurence of this custom component depending on the data.

      What I am having problems doing is working out how to retrieve the values of all the checkboxes after the user presses a button.

      Here is the code in my main mxml file that displays the repeated custom component

      [code]

      <mx:VBox width="720" height="190" id="markSheetTile">

      <mx:Repeater id="markSheet10NewRepeater" dataProvider="{this.markSheet10XMLData}" >
      <local:MarkSheet10Item id="markSheet10NewItem" xmlItem="{markSheet10NewRepeater.currentItem}">
      </local:MarkSheet10Item>
      </mx:Repeater>
      </mx:VBox>

      [/code]

      And here is my code for the custom component

      [code]

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="600">
      <mx:DataGrid x="20" y="36" showHeaders="false" width="525" id="markSheetSectionDG" wordWrap="true" variableRowHeight="true" editable="true" dataProvider="{markSheet10DGDataAC}" height="100%">
      <mx:columns>

      <mx:DataGridColumn headerText="" dataField="blockTitle" editable="false" />

      <mx:DataGridColumn dataField="blockMark"
      itemRenderer="mx.controls.CheckBox"
      rendererIsEditor="true"
      editorDataField="selected" headerText="" editable="true" />

      </mx:columns>
      </mx:DataGrid>
      <mx:Text text="{_xmlItem.subTitle}" x="20" y="10" id="subTitle" fontWeight="bold"/>

      <mx:Script>


      <![CDATA[

      import mdm.*;
      import bin.uk.co.ultravioletdesign.utils.*;
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;

      [Bindable]
      public var _xmlItem:XML;



      [Bindable]
      public var markSheet10DGData:XMLList;

      [Bindable]
      public var markSheet10DGDataAC:ArrayCollection;



      /** Setter function */
      public function set xmlItem(xml:XML):void
      {
      mdm.Dialogs.prompt("custom component set xml value");
      _xmlItem = xml;

      markSheet10DGData = _xmlItem.block;

      mdm.Dialogs.prompt("markSheet10DGData = " + markSheet10DGData);

      var howManyBlocks:uint = markSheet10DGData.length();

      mdm.Dialogs.prompt("howManyBlocks new = " + howManyBlocks);

      markSheet10DGDataAC = new ArrayCollection();

      for (var i:uint = 0; i < howManyBlocks; i++) {

      markSheet10DGDataAC.addItem({blockTitle: markSheet10DGData .blockTitle, blockMark: markSheet10DGData.blockMark});


      }


      }

      /** Getter function */
      public function get xmlItem():XML
      {
      return _xmlItem;
      }//get xmlItem


      ]]>
      </mx:Script>






      </mx:Canvas>



      [/code]

      I would really appreciate any assistance.

      Thanks

      Paul