Click here to Skip to main content
15,892,674 members

How to get selected values (using checkBox) from DataGrid in flex.

tanujm asked:

Open original thread
i have a datagrid which is getting values from a XML file (getting this xml file from database using PHP and HTTP request in flex). i have created a checkbox in every row in data grid. and here is my requirement: i want to select tow or three check-box and would like to get all the values form that particular ROWs in some form , prefered arraycollection (such that i can pass this array directly to a bar chart) .. can some one help me as i am new to flex .
code .....
XML
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="siteData.send()">
	<mx:Script>
		<![CDATA[
			import mx.collections.XMLListCollection;
			import mx.controls.*;
			import mx.events.ListEvent;
			import mx.rpc.events.ResultEvent;
			import mx.controls.Alert;
			[Bindable] private var fullXML:XMLList; 
			private function contentHandler(evt:ResultEvent):void{
				fullXML = evt.result.values;
			}
		
		
	</mx:Script>
	<mx:VBox>
		<mx:Label text="This Data Grid is loading the full XML file"/>
		<mx:DataGrid width="600"  id="datagrid" dataProvider="{fullXML}">
			
			<mx:columns>
				<mx:DataGridColumn headerText="Select">
					<mx:itemRenderer>
						<mx:Component>
							<mx:HBox horizontalAlign="center">

								<mx:CheckBox id="check"/>
							</mx:HBox>
						</mx:Component>
					</mx:itemRenderer>
				</mx:DataGridColumn>
				<mx:DataGridColumn dataField="release_version" headerText="Release"/>
				<mx:DataGridColumn dataField="build" headerText="build"/>
				<mx:DataGridColumn dataField="time_login" headerText="time_login"/>
				<mx:DataGridColumn dataField="time_tunnel" headerText="time_tunnel"/>
				<mx:DataGridColumn dataField="rate_login" headerText="time_tunnel"/>
				<mx:DataGridColumn dataField="rate_tunnel" headerText="rate_tunnel"/>
			</mx:columns>
		</mx:DataGrid>
	</mx:VBox>
	<mx:HTTPService url="http://localhost/php_genxml.php" id="siteData" result="contentHandler(event)" resultFormat="e4x"/>
</mx:Application>


I want to select some check box and want to get the values of all the fields in data-grid correspond to that check-box, can some one help me how to get the selected values (selected values of check-box) in flex and action script.
Tags: PHP, Checkbox, DataGrid, Flex

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900