You need to define a custom sort function.

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Kenneth Sutherland
Sent: Wednesday, December 17, 2008 9:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] sort XMLListcollection in dp

 

I'm trying to apply a sort to an XMLListcollection that is assigned to a
dataprovider.

 

Each element of the collection has the following format and I've no
control over the format to change it.

<f>

          <ra>blah</ra>

          <ro>blah</ro>

          <fs>

                   <di>the name to filter on</di>

                   <s>other stuff</s>

          </fs>

</f>

 

I am trying to sort on the node <di> so I've done the following

 

var sort:Sort = new Sort();

sort.fields = [new SortField("di", true, true)];

 

and applied that to the dataprovider that contains the XMLListCollection
and done the refresh.

I doesn't do the sort but what it does do is swap the first element of
the collection with another halfway through the collection (so if
collection has 22 elements the is swaps [0] with [11]).

 

If I do the sort on nodes such as 'ra' or 'ro' (new SortField("ra",
true, true)]; or new SortField("ro", true, true)];) then they work fine
so I'm presuming it's because the node 'di' is another level below the
main children.

 

Any ideas?

 

Cheers.

 

________________________________

realise

.

 

Kenneth Sutherland

Technical Developer

Realise Ltd
Quay House, 142 Commercial Street, Leith, Edinburgh EH6 6LB
Tel 0131 476 7432
www.realise.com <http://www.realise.com/> 

Check out some of our recent flex work:
* Focus on funds UK <http://www.focusonfunds.co.uk/> 
* Focus on funds Europe
<http://europe.standardlifeinvestments.com/distributor/products_and_serv
ices/going_further_focus_on_funds/index.html> 
* Fund selector
<http://uk.standardlifeinvestments.com/ifa/adviser_support/index.html> 

* Video view
<http://uk.standardlifeinvestments.com/ifa/market_views/video_view_and_m
p3s/index.html> 
Realise are sponsors of the Marketing Society Scotland.
Realise Limited is registered in Scotland, SC172507.

 

 



Disclaimer 

________________________________

This electronic message contains information which may be privileged and
confidential. The information is intended to be for the use of the
individual(s) or entity named above. If you are not the intended
recipient, be aware that any disclosure, copying, distribution or use of
the contents of this information is prohibited. If you have received
this electronic message in error, please notify us by telephone on 0131
476 6000 and delete the material from your computer.
Registered in Scotland number: SC 172507.
Registered office address: Quay House 142 Commercial Street Edinburgh
EH6 6LB.

This email message has been scanned for viruses by Mimecast.

________________________________

 

Reply via email to