views:

1718

answers:

2

In my project i used one select all button for select all checkbox at click event . But i used datagrid ,iteam renderer within checkbox so no id of checkbox then how to select/unselect all checkbox ?

<mx:DataGrid id=newdatagrid>
<mx:columns>

<mx:DataGridColumn headerText="1"  rendererIsEditor="true" editorDataField="selected">
           <mx:itemRenderer>
            <mx:Component>
<mx:CheckBox click="{data.check1 = (data.check1 != 'true') ? 'true' : 'false'};outerDocument.toggleCheckbox(data);outerDocument.calcValues();" dataChange="this.selected=outerDocument.validateCheckbox(data)"/>
        </mx:Component>
              </mx:itemRenderer>
           </mx:DataGridColumn>

        </mx:columns>
       </mx:DataGrid>

how can i implement select/unselect all button for checkbox?

+1  A: 

First, bind the selected property of your checkbox in the itemrenderer to the "check1" property of your dataprovider items:

<mx:CheckBox selected="{data.check1}"/>

Then set the "check1" property of each item in the dataprovider in response to a button click.

for each (var item:Object in dataProvider) {
  item.check1 = true; // or false;
}
Christophe Herreman
How can i set check1 property to each iteam in the dataprovider but i tried but not get
R.Vijayakumar
A: 

Hi I tried the same , but event though the dataprovider is bindable still the check1 changes does not reflect on selected property of checkbox

geekuser