Use a labelFunction.

In a script block have something like this:

function showTotal(item:Object):String
{
  return "$" + (item.qty*item.price).toString();
}

and then your column would have labelFunction="showTotal" as an attribute.

I havent tested this code but something like this should work.

Andrew.
www.flexdaddy.info



--- In flexcoders@yahoogroups.com, "Rajesh Jayabalan" <[EMAIL PROTECTED]> wrote:
> Hi,
> 
>  How can I calculate values of datagrid column based on other datagrid
> columns.
> 
>  i.e.,
> 
>  <mx:DataGrid>
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn columnName="qty" headerText="Quantity"
marginLeft="4"/>
> <mx:DataGridColumn columnName="price" headerText="Price"
marginLeft="4"/>
> <mx:DataGridColumn columnName="total" headerText="Total" />
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
> 
> 
> How can I calculate the total at runtime so that it will always
> display qty*price
> 
> both qty and cost are user editable.
> 
> Regards
> Rajesh J




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h89461f/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123555688/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to