This works when used with a TextInput, but does not work with a 
labelFunction with a DataGrid.  I'm getting relaly weird results like 
$"0.00" when you pass a 0 to the CurrencyFormatter.format function.

Why does this work perfectly with a TextField, but not with labelFunction 
for a DataGrid?

This works:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>

 <mx:Script>
 <![CDATA[

  import com.mindspacexi.utils.StrUtils;

  function format1()
  {
   test1_ti.text = USDformatter.format(test1_ti.text)
  }


 ]]>
 </mx:Script>

 <mx:CurrencyFormatter id="USDformatter" precision="2" currencySymbol="$" 
decimalSeparatorFrom="."
        decimalSeparatorTo="." useNegativeSign="true" 
useThousandsSeparator="true" alignSymbol="left"/>

 <mx:VBox width="100%" height="100%">

  <mx:FormItem label="Currency Formatter:">
   <mx:TextInput id="test1_ti" focusOut="format1()" enter="format1()" />
  </mx:FormItem>

 </mx:VBox>
</mx:Application>

However, this psuedo code does not:

function formatPrice( item : Object, columnName : String ):String
{
 var formattedPrice:String = USDformatter.format(item.price);
 return formattedPrice;
}

I have confirmed through traces & debugs that item.price is in fact 0. 
Strangely, even hardcoding 0 or "0" into the USDformatter.format function 
still results in the $"0.00" problem.

!?!?

--JesterXL




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