Try this 

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml";>

            <mx:Script>

                        <![CDATA[

                                    import
mx.formatters.NumberFormatter;

                                    private var
numberFormater:NumberFormatter = new NumberFormatter();

                                    override public function set
data(value:Object):void {

                                                text= "$ " +
numberFormater.format(value[listData["dataField"]]);

                                    }

                        ]]>

            </mx:Script>

</mx:Label>

 

Thank you

 

David Faynzilberg

Software Developer/Analyst

 

TRX

6 West Druid Hills Drive

Atlanta Georgia 30329 USA

Office: 404 417-7135

 

[EMAIL PROTECTED]

 

This message is intended only for the use of the Addressee and may
contain information that is PRIVILEGED and CONFIDENTIAL. If you are not
the intended recipient, dissemination of this communication is
prohibited. If you have received this communication in error, please
erase all copies of the message and its attachments and notify us
immediately.

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Ford
Sent: Wednesday, May 28, 2008 4:35 PM
To: [email protected]
Subject: Re: [AFFUG Discuss] Sorting formatted data in ADG

 

Hi Robert,

Unfortunately the problem occurs regardless of options used on the
CurrencyFormatter, or even the formatter used for that matter. I've
experimented with CurrencyFormatter, NumberFormatter, and others. The
ADG behaves the same when using the DateFormatter as well.

Below is a simpler example that demonstrates the problem, this time
using a basic DataGrid...


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">

    <mx:CurrencyFormatter id="moneyFormatter" currencySymbol="$"
precision="0"/>
    
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;

            [Bindable]
            private var myData:ArrayCollection = new ArrayCollection([
                {Region:'East', SalesRep:'Agent A', QuoteID:1,
Quoted_Total:5000, Quoted_HW:4000, Quoted_Svcs:1000, Quoted_Maint:0},
                {Region:'East', SalesRep:'Agent A', QuoteID:2,
Quoted_Total:7000, Quoted_HW:4000, Quoted_Svcs:3000, Quoted_Maint:0},
                {Region:'West', SalesRep:'Agent B', QuoteID:3,
Quoted_Total:3000, Quoted_HW:2500, Quoted_Svcs:500, Quoted_Maint:0},
                {Region:'Central', SalesRep:'Agent C', QuoteID:4,
Quoted_Total:1000, Quoted_HW:0, Quoted_Svcs:0, Quoted_Maint:1000},
                {Region:'West', SalesRep:'Agent B', QuoteID:5,
Quoted_Total:200, Quoted_HW:4000, Quoted_Svcs:1000, Quoted_Maint:200},
                {Region:'Central', SalesRep:'Agent C', QuoteID:6,
Quoted_Total:11000, Quoted_HW:7000, Quoted_Svcs:2000,
Quoted_Maint:2000},
                {Region:'East', SalesRep:'Agent B', QuoteID:7,
Quoted_Total:1000, Quoted_HW:800, Quoted_Svcs:0, Quoted_Maint:200},
                {Region:'East', SalesRep:'Agent A', QuoteID:8,
Quoted_Total:20000, Quoted_HW:15000, Quoted_Svcs:3000,
Quoted_Maint:2000},
                {Region:'West', SalesRep:'Agent B', QuoteID:9,
Quoted_Total:6000, Quoted_HW:3000, Quoted_Svcs:2500, Quoted_Maint:500}
            ]);
        ]]>
    </mx:Script>

    <mx:DataGrid id="analysisGrid" dataProvider="{myData}" left="10"
right="10" bottom="10" showHeaders="true" top="106">
        <mx:columns>
            <mx:DataGridColumn headerText="Sales Rep"
dataField="SalesRep"/>
            <mx:DataGridColumn headerText="Unformatted Total (Flex
sorts)" dataField="Quoted_Total"/>
            <mx:DataGridColumn headerText="Formatted Total (Flex won't
sort)">
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:Label
text="{outerDocument.moneyFormatter.format(data.Quoted_Total)}"/>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>
    <mx:TextArea y="10" left="10" right="10" fontWeight="bold"
fontSize="14" editable="false" height="88" backgroundAlpha="0.75"
cornerRadius="4">
        <mx:text>Try clicking each column heading several times to see
the sort behavior. You will find that Flex does not sort the final
column properly.</mx:text>
    </mx:TextArea>
    
</mx:Application>



------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in
the subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink <http://www.fusionlink.com>  
------------------------------------------------------------- 




-------------------------------------------------------------

To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line



For more info, see http://www.affug.com

Archive @ http://www.mail-archive.com/discussion%40affug.com/

List hosted by http://www.fusionlink.com

-------------------------------------------------------------

Reply via email to