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


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

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


      And here is my code for the custom component


      <?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:DataGridColumn headerText="" dataField="blockTitle" editable="false" />

      <mx:DataGridColumn dataField="blockMark"
      editorDataField="selected" headerText="" editable="true" />

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



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

      public var _xmlItem:XML;

      public var markSheet10DGData:XMLList;

      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




      I would really appreciate any assistance.