- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
I am trying to find some documentation and samples explaining how I can pick something in a combobox and have it populate a series of datagrids and charts.
OUTLINE:
A. Using an XML table of all municipalities in our region populate a combobox. Then have the user select the municipality they are interested in.
B.Take a census table that is in XML format and by using HTTPServices read it into Flex and then based on what municipality the user selected populate a datagrid and variety of charts with data pertaining to the muni.
I know it is done because I see it all the time and took a class last week where it was shown. Unfortunately it was the last day of the class and time was running out so we just got a brief overview of this.
I would greatly appriciate anyone who can point me to samples and documentation whether it be online or in books. And I should mention that terminology is still an issue. Am I attempting to do a custom event or what?
The code below all works. What I mean I am successfully populating the combobox and the datagrid with the appropriate data. I am just not able to get the two communicating with each other. In other words the datagrid is showing the entire table and ignoring the combobox.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.rpc.events.*;
import mx.controls.*;
import mx.charts.*;
import mx.collections.*;
[Bindable]
private var acMuni:ArrayCollection = new ArrayCollection;
[Bindable]
private var acCity:ArrayCollection = new ArrayCollection;
private function initApp():void {
muniHS.send();
cityHS.send();
}
private function eHandler(e:ResultEvent):void {
acMuni = e.result.GetAllMUNIS.MUNIS;
}
private function fHandler(e:FaultEvent):void {
var faultInfo:String="fault code: "+ e.fault.faultCode +"\n\n";
faultInfo+="fault string: "+e.fault.faultString+"\n\n";
mx.controls.Alert.show(faultInfo,"Fault Information");
var eventInfo:String="event target: "+e.target+"\n\n";
eventInfo+="event type: "+e.type+"\n\n";
mx.controls.Alert.show(eventInfo,"Event Information");
}
private function eCityHandler(e:ResultEvent):void {
this.acCity = e.result.GetCITIES.CITIES;
}
]]>
</mx:Script>
<mx:HTTPService id="muniHS"
url="data/GetAllMunis.xml"
result="eHandler(event)"
fault="fHandler(event)"
showBusyCursor="true"/>
<mx:HTTPService id="cityHS"
url="data/CityNames.xml"
resultFormat="object"
result="eCityHandler(event)"
fault="fHandler(event)"
showBusyCursor="true"/>
<mx:Panel width="100%" height="50%"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
paddingTop="10" title="DataGrid">
<mx:ComboBox id="muniCB"
dataProvider="{acCity}"
prompt="Select a Municipality"
labelField="city"/>
<mx:DataGrid id="dg"
width="100%"
height="100%"
dataProvider="{acMuni}">
<mx:columns>
<mx:DataGridColumn headerText="municipality" dataField="city"/>
<mx:DataGridColumn dataField="year"/>
<mx:DataGridColumn headerText="month" dataField="month_no"/>
<mx:DataGridColumn headerText="labor force" dataField="laborforce"/>
<mx:DataGridColumn dataField="employed"/>
<mx:DataGridColumn dataField="unemployed"/>
<mx:DataGridColumn headerText="unemployment rate" dataField="unemp_rate"/>
<mx:DataGridColumn headerText="tract" dataField="geogkey"/>
<mx:DataGridColumn headerText="extended tract" dataField="geogkeyx"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>
Thanks for any help you can provide
Richard Krell
Solved! Go to Solution.
Views
Replies
Total Likes