[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DataGrid with checkbox

Posted on 2011-05-10
5
Medium Priority
?
335 Views
Last Modified: 2012-05-11
Hello, I would like to build a structure where I can in a datagrid
select the lines that I want, and then retrieve those rows in php

AMFPHP
0
Comment
Question by:eduardo12fox
  • 3
  • 2
5 Comments
 

Author Comment

by:eduardo12fox
ID: 35732158
I could do but can not get the IDs of each line because I Id
bring the following mysql abax structure:

How can I get the elements that were selected
<mx:DataGrid x="10" y="56" height="335" width="864" dataProvider="{DadosSericard}" id="Grid_Retorno_Sericard">
						<mx:columns>
				<mx:DataGridColumn headerText="CHECADOS" dataField="online" width="90" textAlign="center">
                                <mx:itemRenderer>
                                    <mx:Component>
                                        <mx:CheckBox click="{fnTeste()}"  selected="{data.online}" >        
                                        
                                        <mx:Script>
                                            <![CDATA[
                                                import mx.controls.Alert;
                                                import mx.core.Application;
                                                
                                                        private function fnTeste ():void{
                                                           
                                                           Alert.show(Application.application.Grid_Retorno_Sericard.selectedItem.Id);
                                                            
                                                        }                                                    
                                                
                                            ]]>
                                        </mx:Script>  
                                        
                                        </mx:CheckBox>
                                            
                                    </mx:Component>                        
                                </mx:itemRenderer>
                </mx:DataGridColumn>
							<mx:DataGridColumn headerText="DATA" dataField="data_cad" width="80"/>
							<mx:DataGridColumn headerText="CÓDIGO" dataField="cod"/>
							<mx:DataGridColumn headerText="NOME" dataField="nome"/>
							<mx:DataGridColumn headerText="VALOR" dataField="valor" width="100"/>
							<mx:DataGridColumn headerText="TELEFONE" dataField="telefone" width="100"/>
							<mx:DataGridColumn headerText="CELULAR" dataField="celular" width="100"/>
							<mx:DataGridColumn headerText="OBS." dataField="obs" width="100"/>
							<mx:DataGridColumn headerText="OPERADOR" dataField="operador" width="100"/>
						</mx:columns>
					</mx:DataGrid>

Open in new window

0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 35732989
private fnTests():void {

data.selected= !data.selected;

}


Look at the example

http://blog.flexexamples.com/2008/01/27/using-a-checkbox-control-as-a-list-item-renderer-in-flex/
0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 35733049
I located simple example, which demos the mechanics of updating the data source.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
      <mx:Script>
            <![CDATA[
                  import mx.events.CollectionEvent;
                  public function update(event:CollectionEvent):void {
                        srcData.refresh();
                  }
            ]]>
      </mx:Script>
      <mx:ArrayCollection id="srcData">
            <mx:source>
                  <mx:Object display="Option 1" selected="false"/>
                  <mx:Object display="Option 2" selected="true"/>
                  <mx:Object display="Option 3" selected="false"/>
                  <mx:Object display="Option 4" selected="false"/>
            </mx:source>            
      </mx:ArrayCollection>
      <mx:HBox>
            
      <mx:DataGrid dataProvider="{srcData}" width="200" height="400">
            <mx:columns>
                  <mx:DataGridColumn headerText="Selected Options" dataField="selected">
                        <mx:itemRenderer>
                              <mx:Component>
                                    <mx:CheckBox label="{data.display}" selected="{data.selected}" click="data.selected= !data.selected; outerDocument.srcData.refresh(); trace(data.selected);"/>
                              </mx:Component>
                        </mx:itemRenderer>
                  </mx:DataGridColumn>
            </mx:columns>
      </mx:DataGrid>
      <mx:DataGrid dataProvider="{srcData}" width="200" height="400"/>
      </mx:HBox>
                  
</mx:Application>
0
 

Author Comment

by:eduardo12fox
ID: 35734259
AS ALWAYS PERFECT RESULT! THIS IS WHAT I NEED. VERY GRATEFUL.
0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 35740274
Thanks.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 20 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question