Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Iterate through ItemRenderer Checkboxes in a DataGrid

Community Beginner ,
May 02, 2019 May 02, 2019

Hi,

I have a datagrid with checkboxes in the first third and fourth columns. Each of these checkboxes is to be assigned a value from the data source that it is bound to. My task is simple:

1) Iterate through all the DataGrid rows, 2) see if the checkbox is checked, and 3) get the checkbox value.

Could someone please post a working example for me?

Thank you.

This is how the DataGrid looks:

And here's the code for the checkbox column:

<mx:DataGridColumn dataField="downloadIndicator"

   editable="true"

   editorDataField="selected"

   rendererIsEditor="false"

   width="{this.width*.05}"   

   sortable="false">

<mx:headerRenderer>

<mx:Component>

<mx:HBox horizontalAlign="center">

<mx:CheckBox

click="headerDownload_clickHandler(event)"

toolTip="{ResourceUtil.getResourceValue('allColors.downloadToolTip', parentDocument.selectedCompany.name,'strings',Util.getLocale())}"

selected="{parentDocument.chkAllSelected}">

<mx:Script>

<![CDATA[

import com.phototype.myinkiq.model.vos.dtos.AllColorsDto;

import com.phototype.myinkiq.model.vos.dtos.ColorsDto;

import com.phototype.util.ResourceUtil;

import com.phototype.util.Util;

protected function headerDownload_clickHandler(event:MouseEvent):void

{

if (event.currentTarget!=null) {

parentDocument.chkAllSelected = event.currentTarget.selected;

var i:int=0;

var color:AllColorsDto = null;

for (i=0; i<parentDocument.colorsDtoCollection.length;i++) {

color = parentDocument.colorsDtoCollection.getItemAt(i) as AllColorsDto;

if (color.r!=null)

color.downloadIndicator = event.currentTarget.selected;

else

color.downloadIndicator = false;

}

}

}

]]>

</mx:Script>

</mx:CheckBox>

</mx:HBox>

</mx:Component>

</mx:headerRenderer>

<mx:itemEditor>

<mx:Component>

<itemRenderers:CheckBoxRenderer selected="{data.downloadIndicator}"

enabled="{data.r!=null}"/>

</mx:Component>

</mx:itemEditor>

<mx:itemRenderer>

<mx:Component>

<itemRenderers:CheckBoxRenderer selected="{data.downloadIndicator}"

enabled="{data.r!=null}"

/>

</mx:Component>

</mx:itemRenderer>

</mx:DataGridColumn>

TOPICS
ActionScript
388
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2019 May 08, 2019
LATEST

i could help you if you used flash/animate, but that looks like flash builder or like some other non-flash/non-animate authoring tool was used.

my guess is others checking this forum feel the same because no one's responded and it's been almost one week since you posted.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines