user1077544
user1077544

Reputation: 71

How to modify a column in an Adobe Flex datagrid, populated with data from a database

In another application I have retrieved and stored a user's data, including their date of birth. In this application i'm making a call to the database and populating my datagrid with that information. I'd like to display the user's age though instead of their DOB. I was wondering if it's possible to modify the column so it will display this.

If it's not possible I will have to calculate this and store the user's age in the database, but I feel it is not the best solution as their age will change and the DOB won't.

Upvotes: 0

Views: 296

Answers (1)

debracey
debracey

Reputation: 6597

Yes, you would add an item renderer to the column in question, you can then manipulate the data as you see fit. You can take the DOB value and do simple math to figure out the user's age.

Scroll about 1/4 way down the DataGrid section:

http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html

You could also use a label function to do this -- similar to what is asked in this question from only a few hours ago:

Flex: DataGrid column formatting of numbers

Upvotes: 1

Related Questions