adding static employees crud example

This commit is contained in:
Dan Buch 2010-02-18 13:32:20 -05:00
parent 27625fa8d8
commit 9b1c18912f
4 changed files with 55 additions and 1 deletions

View File

@ -3,7 +3,7 @@
layout="absolute">
<mx:Script>
<![CDATA[
include "employees.as";
include "dyn-employees.as";
]]>
</mx:Script>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
include "static-employees.as";
]]>
</mx:Script>
<mx:HTTPService
id="employeesService"
url="http://www.flexmonkeys.com/F3GSE/PartIII/CRUD/employees.xml"
resultFormat="e4x"
result="resultHandler(event)" />
<mx:ViewStack id="viewstack1" width="100%" height="100%" >
<mx:Canvas label="Form View" width="100%" height="100%">
<mx:Form horizontalCenter="0" verticalCenter="0" backgroundColor="#FFFFFF">
<mx:FormItem label="Query Employees ">
<mx:Button label="Submit" click="fill()" width="100"/>
</mx:FormItem>
</mx:Form>
</mx:Canvas>
<mx:Panel label="DataGrid View" width="100%" height="100%">
<mx:DataGrid width="100%" height="100%" dataProvider="{result.employee}">
<mx:columns>
<mx:DataGridColumn dataField="firstName" headerText="First Name"/>
<mx:DataGridColumn dataField="lastName" headerText="Last Name"/>
<mx:DataGridColumn dataField="officePhone" headerText="Phone"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:ViewStack>
</mx:Application>

View File

@ -0,0 +1,20 @@
import mx.rpc.events.ResultEvent;
private var params:Object;
[Bindable]
private var result:XML;
private function initApp():void{
employeesService.cancel();
params= new Object();
}
public function resultHandler(event:ResultEvent):void {
result = XML( event.result);
}
public function fill():void{
viewstack1.selectedIndex=1;
employeesService.send(params);
}