var formatter:CurrencyFormatter = null;
public function return function (item:Object, dgc:DataGridColumn):String { 
     if (formatter == null) {
      formatter = new CurrencyFormatter();
      CurrencyFormatter(formatter).precision=2;     
}
      return formatter.format(item[dgc.dataField]);
}

 
On 9/21/06, s_hernandez01 <[EMAIL PROTECTED]> wrote:

I used the labelfunction method and need a little help on the
actionscript for the datagrid because I keep getting an error. All I
want is for it to display the dollar sign with two decimal places:

<mx:Script>
<![CDATA[

public function myLabelFunc(item:Object):String{
return "$" + data.price;
}

]]
</mx:Script>

<mx:DataGrid id="conduitGrid"
dataProvider="{ srv2.lastResult.conduit2.product}"
height="73%" alternatingItemColors="[#c0e9fe, #ffffff]" x="0" y="0">
<mx:columns>

<mx:DataGridColumn headerText="Price" dataField="price" id="dgPrice"
width="70" labelFunction="myLabelFunc"/>

</mx:columns>
</mx:DataGrid>

-Sal

--- In [email protected], "Anatole Tartakovsky"
<[EMAIL PROTECTED]> wrote:
>
> use LabelFunction
>
> On 9/20/06, s_hernandez01 <[EMAIL PROTECTED]> wrote:
> >
> > Does anyone know how to set the currencyformatter with a dollar
sign
> > and two decimal places in a datagrid without it having no affect on
> > totaling all the items in the column?
> >
> >
> >
>


__._,_.___

--
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

__,_._,___

Reply via email to