FLEXing Your Business Application
to group the category into the description field. So back to the code to remove the Category as a column and add it as a Group, see (Listing 3). Now we need to provide the data source for the AdvancedDataGrid and in FLEX which is called an arraycollection. An ArrayCollection is much like a DataTable object in ADO.NET. or a Multi-Array. We can create the Array Collection with the following code: import mx.collections.ArrayCollection; private var MyStructuredDataFromInpu ts:ArrayCollection = new ArrayCollection(); But before we can add this piece of actionscript to our page we need to add the scripting heard/footer to our page, much the same way you do when you add javascript to an html page. Please the code
snippet just below the head for the page, see (Listing 4). Complete the modification by adding the ArrayCollection as the source:
to collect the data. Open the Structured DataFromInputs.cs file and add the code below to pull the requested data, see (Listing 5). That is all that is necessary to provide the function for gathering data from our SQL Server Database. Now let’s create functionality within our page. Add the imports for the webservice objects we will use:
import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.WebService;
Create a webservice object, see (Listing 6). Before running the MXML Application, add the initApp() function to the Application header.
A D V E R T I S E M E N T
Made with FlippingBook HTML5