Select to view content in your preferred language

embedding a datagrid in a Repeater

827
2
12-19-2011 07:02 AM
DebbieAlger
Deactivated User
I have had some success placing a datagrid into a repeater, but not total success. I basically want
a Repeater of completed results, within each result there is a datagrid dedicated to the result. I have tried putting arrays into arrays, and arrays into arraycollections, but all the data goes into the first datagrid. This also opens up the next problem, how to get access to each individual result in each datagrid.

Example of what I want.

Result 1
Datagrid with 4 rows of info related to Result 1

Result 2
Datagrid with 4 rows of info related to Result 1

etc.

thanks,
Tags (2)
0 Kudos
2 Replies
DebbieAlger
Deactivated User
OK, I actually figured out the datagrid in repeater, but now have a problem getting access to the index of each individual item in the datagrid. I can get the index and info of the parent repeater information, but not the datagrid info, such as the checkbox index.

thanks.
BTW, is there a better way for me to show code in these forums???


//==== THIS IS HOW I ACCESS REPEATER INFORMATION ON A CLICK EVENT
private function btnShowCharacterize(evt:Event):void
   {
  
   
    Alert.show ("current name - " + evt.currentTarget.getRepeaterItem().wsName);
    Alert.show ("current index - " + evt.currentTarget.repeaterIndices + " open/close - " + openCloseArray[index].toString());
}

//==== THIS IS THE REPEATER AND DATAGRID AREA

<mx:VBox height="325"  horizontalScrollPolicy="off"  verticalScrollPosition="{this.width - 10}" verticalScrollPolicy="auto"  >    
    
      <mx:Repeater  dataProvider="{wsArray}"  id="wRepeater"   >
       <mx:HRule width="100%" />
       <mx:HBox    >            
        <s:Label   text="             "  />
        <s:Label   text="             " />
        <mx:Image  click="remove(event )"   source="assets/images/delete_x.PNG"  width="20" height="20"  />      
        <s:Label   text="             "  />       
        <mx:Image    click="Export(event )" source="assets/images/export.png"   width="20" height="20" />       
        <s:Label   text="             "  />       
        <s:Label   text="{wRepeater.currentItem.wsName}"  styleName="WidgetText"    />
       
       </mx:HBox>
       <s:Label    text=" "  />
       <mx:HBox>
       <mx:Image  id="showCharacterize" click="btnShowCharacterize(event)"  source="assets/images/plus.png"  width="15" height="15"    />
       <s:Label   fontWeight="bold" text=" Characterize"  styleName="WidgetText"   visible="true"  />
       </mx:HBox>
      
     
       <!-- Datagrid of created watersheds -->
      <!-- <s:Label  text="" styleName="WidgetText" /> -->
          <mx:VBox id="displayDatagrid"  height="0" visible="false" >
       
       <mx:DataGrid id="datagrid" dataProvider="{wRepeater.currentItem.gridData}"   rowCount="5" styleName="WidgetText" itemClick="dgClick(event)"   >
        <mx:columns>
         <mx:DataGridColumn headerText="Characterization"    dataField="charType" width="125"/>
         <mx:DataGridColumn headerText="Value"    dataField="charValue" width="75"/>
         <mx:DataGridColumn headerText="Select"   dataField="charChkBox" width="50"    itemRenderer="mx.controls.CheckBox" />
        </mx:columns>       
       </mx:DataGrid>     
      
       <s:Button    id="btnCharacterize" click="characterize(event)"   label="Calculate Selected Characteristics" width="250"  />
      </mx:VBox>
0 Kudos
KenBuja
MVP Esteemed Contributor
To show the code, click on the # symbol in the strip above the editor.

//==== THIS IS HOW I ACCESS REPEATER INFORMATION ON A CLICK EVENT
private function btnShowCharacterize(evt:Event):void
            {
            
                
                Alert.show ("current name - " + evt.currentTarget.getRepeaterItem().wsName);
                Alert.show ("current index - " + evt.currentTarget.repeaterIndices + " open/close - " + openCloseArray[index].toString());
}


0 Kudos