Hmm, if we’re screwing that up you may want to use your own comparator function.  See sortCompareFunction on DataGridColumn.

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alban Soupper
Sent: Friday, October 07, 2005 5:45 AM
To: Flexcoders (E-mail)
Subject: [flexcoders] Datagrid sort on float numbers problem

 

Hi all,

I have the following service:
      <mx:HTTPService id="search" method="get" url="">
showBusyCursor="true"/>

and this datagrid
      <mx:DataGrid dataProvider="{search.result.results.fund}" width="100%">
        <mx:columns>
          <mx:Array>
            <mx:DataGridColumn headerText="Fund" columnName="name"/>
            <mx:DataGridColumn headerText="Perf" columnName="lastReturn"/>
          </mx:Array>
        </mx:columns>
      </mx:DataGrid>

the httpService return the following xml in its response:
<?xml version="1.0" encoding="UTF-8"?>
<results>
      <fund>
            <name><![CDATA[Fund 2]]></name>
            <lastReturn>-0.03345107356650445</lastReturn>
      </fund>
      <fund>
            <name><![CDATA[Fund 8]]></name>
            <lastReturn>-7.429962234167808E-4</lastReturn>
      </fund>
      <fund>
            <name><![CDATA[Fund 9]]></name>
            <lastReturn>0.03247207098433136</lastReturn>
      </fund>
      <fund>
            <name><![CDATA[Fund 11]]></name>
            <lastReturn>7.550032224670211E-4</lastReturn>
      </fund>
</results>

but when I sort the Perf column I obtain this:
0.03247...
0.00075...
-0.03345...
-0.00074...

instead of
0.03247...
0.00075...
-0.00074...
-0.03345...

It seams that the DataGrid sort mechanism on my service result interprets
correctly the perf correctly as Numbers (7.550032224670211E-4 is transformed
in -0.00074...) but sort the values as string.


Question:
What's happening?
How to solve this situation?



***********************************************************************************

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager to [EMAIL PROTECTED]

***********************************************************************************




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




Reply via email to