Flex 2.1 changing the percision to two resulted in the appropriate sorting 
behavior.

Also tested with changing the second column to one of the other objects data 
and still got the normal sorting result.

Try Davids number formatting  override function 
  ----- Original Message ----- 
  From: Kevin Ford 
  To: [email protected] 
  Sent: Wednesday, May 28, 2008 4:34 PM
  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 
  -------------------------------------------------------------


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

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