I need is to select the items through the datagrid checkbox
Selected
And when you click to select items, mount it with an array of items
datagrid I marked the checkbox.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
 <![CDATA[
 import mx.controls.Alert;
 import mx.collections.ArrayCollection;


 [Bindable]
 public var listaId:Number=0;
 [Bindable]
 public var listaArray:Array;


 private function doSeleciona():void
            {
                var itens:ArrayCollection=dg.dataProvider as
ArrayCollection
                if (dg.selectedItem != null){
                 for (var i:int=0; i < itens.length; i++){
                     if (dg.selectedItem.selected == true){
                            listaArray=[dg.selectedItem.data];
                        Alert.show(dg.selectedItem.data);
                     }
                 }
                }else{
                 Alert.show("Você precisa selecionar um Item do Data
Grid");
                }
            }

 ]]>
</mx:Script>


        <mx:DataGrid id="dg" doubleClickEnabled="true"
editable="true">
        <mx:dataProvider>
                <mx:Object col1="Col 1.1 Data" col2="Col 1.2 Data"
data="Data1"
selected="false"/>
                <mx:Object col1="Col 2.1 Data" col2="Col 2.2 Data"
data="Data2"
selected="false"/>
                <mx:Object col1="Col 3.1 Data" col2="Col 3.2 Data"
data="Data3"
selected="false"/>
        </mx:dataProvider>
        <mx:columns>
                <mx:DataGridColumn dataField="col1"
headerText="Coluna
1"
editable="false"/>
                <mx:DataGridColumn dataField="col2"
headerText="Coluna
2"
editable="false"/>
                <mx:DataGridColumn dataField="selected"
headerText="Selected" editorDataField="selected"
rendererIsEditor="true">
                        <mx:itemRenderer>
                                <mx:Component>
                                        <mx:CheckBox
selected="{data.selected}"/>
                                </mx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
        </mx:columns>
</mx:DataGrid>
<mx:Button x="28" y="290" label="Selecionar Itens"
click="doSeleciona()"/>
<mx:Button x="258" y="290" label="Enviar Itens Impressão"
click="doEnviar()"/>
</mx:Application>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to