Flex Database Excel Tutorial – Part II [Beginners]

In this previous tutorial I simply showed how to create a service in Flex and how to use it to create something in the database. Now we’ll use the service to get al the items in the database and to populate a DataGrid.

So, let’s open the project and create a DataGrid:

not difficult hu? Okay and rember to also set some kind of layout for your application otherwise it will be on top of the form.

Now switch to Design View and drag the previously created getAllUser_registered service over the DataGrid, back in the Source View you will see a new function dataGrid_creationCompleteHandler, a new CallResponder, and some new code inside the DataGrid. You can change the headerText to something more appropriate (“User ID, Name, Surname…”) and change the column width.
If you test the application now, you’ll see that all the previously created user is displayed.

img_008I want to make this more dynamic, so that the userlist is updated everytime some one registers; very simple, let’s just add this to the CallResponder:

<s:CallResponder id="createUser_registerdResult" result="createUser_registerdResult_resultHandler(event)"/>

and create this function:

protected function createUser_registerdResult_resultHandler(event:ResultEvent):void
{
	getAllUser_registerdResult.token = userregisterdService.getAllUser_registerd();
	userName.text="";
	userSurname.text="";
	userEmail.text="";
}

Done! In the next part of the tutorial I will export all the data to an xls file.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Home
Twitter Facebook Flickr Vimeo About me Email me