box-o-sand/flex-practice/03a2-crud-dynamic/CRUDDynamic.mxml

59 lines
2.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
include "dyn-employees.as";
]]>
</mx:Script>
<mx:HTTPService
id="employeesService"
url="http://examples.adobe.com/flex3/workingwithdata/employees.php"
resultFormat="e4x"
useProxy="false" />
<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="{listData}">
<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:Form backgroundColor="#FFFFFF">
<mx:FormItem label="Add New Employee">
<mx:Button label="Add..." click="{viewstack1.selectedIndex = 2}"
width="100"/>
</mx:FormItem>
</mx:Form>
</mx:Panel>
<mx:Canvas label="Add New Employee View" width="100%" height="100%">
<mx:Form horizontalCenter="0" verticalCenter="0"
backgroundColor="#FFFFFF">
<mx:FormItem label="First Name">
<mx:TextInput id="inputFirst"/>
</mx:FormItem>
<mx:FormItem label="Last Name">
<mx:TextInput id="inputLast"/>
</mx:FormItem>
<mx:FormItem label="Phone">
<mx:TextInput id="inputPhone"/>
</mx:FormItem>
<mx:FormItem label="Add Employee ">
<mx:Button label="Add" click="insertEmployee()" />
</mx:FormItem>
</mx:Form>
</mx:Canvas>
</mx:ViewStack>
</mx:Application>