
230 Use the Data Management Service
1. Create a three-column editable DataGrid control by adding the following MXML code
after the beginning
<mx:Application> tag in the lesson2.mxml file.
Set the
editable property of the first column to false.
<mx:DataGrid id="dg" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="contactId" headerText="Id"
editable="false"/>
<mx:DataGridColumn dataField="firstName" headerText="First Name"/>
<mx:DataGridColumn dataField="lastName" headerText="Last Name"/>
</mx:columns>
</mx:DataGrid>
2.
Save the file.
3. If you are not using Flex Builder, open the following URL in a browser window:
http://localhost:port/samples/DSLessons/lesson2.mxml
If you are using Flex Builder, run the application from Flex Builder.
The browser window should display the following application:
Import the required ActionScript classes
In this section, you import the mx.collections.ArrayCollection and mx.data.DataService
classes so that you can create a DataService component and an ArrayCollection object. Later
in the tutorial, you will create a DataService component that requests data from a server-side
Data Management Service destination and fills an ArrayCollection object with that data.
1. Create a script block for ActionScript code directly above the <mx:DataGrid> tag in the
lesson2.mxml file:
<mx:Script>
<![CDATA[
]]>
</mx:Script>
Commenti su questo manuale