Thanks Dustin - I was looking at that too -I just got hung up on Flex doing it in a different way, and was looking elsewhere for the answer.Not sure if you remember the FireFly Controls (from Cybersage Software) that Macromedia steamrolled over a few years back, but they dipped into a large chunk of their functionality when they released the V2 Controls for Flash. In the Column definitions, you could literally flag certain columns to be "Subtotal" and "Running Total" type containers. It really was a work of art, until they got absorbed...Again, thanks for your help -Mike
From: [EMAIL PROTECTED]ups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Dustin Mercer
Sent: Wednesday, September 27, 2006 6:39 PM
To: [EMAIL PROTECTED] ups.com
Subject: RE: [flexcoders] Creating calculated columns inside of DataGrid
The labelFunction on the DataGridColumn should do what you are asking. Here is an exerpt from the docs @ http://livedocs.macromedia.com/flex/2/langref/mx/controls/dataGridClasses/DataGridColumn.html
labelFunction
property
labelFunction: Function [read-write]
A function that determines the text to display in this column. By default the column displays the text for the field in the data that matches the column name. However, sometimes you want to display text based on more than one field in the data, or display something that does not have the format that you want. In such a case you specify a callback function using labelFunction.
For the DataGrid control, the method signature has the following form:
labelFunction(item:Object, column:DataGridColumn):String
Where item contains the DataGrid item object, and column specifies the DataGrid column.
A callback function might concatenate the firstName and lastName fields in the data, or do some custom formatting on a Date, or convert a number for the month into the string for the month.
This property can be used as the source for data binding.
Implementation
public function get labelFunction(): Function
public function set labelFunction(value: Function):void
From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups.com] On Behalf Of Mike Anderson
Sent: Wednesday, September 27, 2006 4:24 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Creating calculated columns inside of DataGrid
Hello All,
Are there any tutorials or examples, that demonstrate Grid Columns which
possess the ability to take the contents of other Grid Columns, and
perform calculations?
The clearest example of this, would be an order form - where there would
be a Product and it's related price, and then a blank for Quantity -
then finally, the Total blank - which shows the result of the multiplied
values.
Could any of you point me in the right direction, as how to do this?
Thanks in advance,
Mike
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
- Re: [flexcoders] Creating calculated columns inside of... Anatole Tartakovsky
- Re: [flexcoders] Creating calculated columns insi... Douglas Knudsen
- Re: [flexcoders] Creating calculated columns ... Anatole Tartakovsky
- RE: [flexcoders] Creating calculated columns insi... Mike Anderson
Reply via email to
OK, can't pass... here it goes
In training sessions we usually recommend to stay away from labelFunction as it is being used for formatting and other functionality. Instead on your ActionScript row record you define getter for formula like this:
public function get extendedPrice(data:Object) {
return data.price * data.quantity;
}
That allows you to be able to do ANYTHING with the extendedPrice you can do with regular columns - filter/sort/total/apply labelFunction, use in other expressions like calculations of discounts.
As far as reporting - here is a list of references you can explore on some of our open source free and commercial Flex 2 products
RealWorld Flex video - http://www2.sys-con.com/webinararchive.cfm?pid=wc_rwf6_s02fain®istered=on
The last 10 minutes is reportwriter and language extensions for computed expressions in dataGrid
For whatever screen capture video is out of sync, so here are slides and video http://www.faratasystems.com/?page_id=70 . You will need codec listed on the page in order to see video of the running system.
Of course, you can see it live - either @ max'06 or by contacting the presenters.
Regards,
Anatole Tartakovsky
On 9/27/06, Mike Anderson <[EMAIL PROTECTED]> wrote:

