Thank you for your thoughts about this. Through trial and error and
a little bit of frustration I am coming to the conclusion that
sorting the data in the specific view is perhaps the only way to do
it with "Managed" data. Sorting on the server seems like a waste
unless the data never needs to be manipulated on the client. So with
that in mind, here is the specific problem that I have encountered
and I am wondering if there is a more elegant solution for.
Let's say I have an object MyParty which holds the following
collections:
MyParty
- people (collection of people at the party)
- events (things that are happening)
- supplies (..you get the idea)
I would like to bind these nested collections to components
<mx:TileList dataProvider="{MyParty.people}" />
<mx:List dataProvider="{MyParty.supplies}" />
So where to apply the sort? Temporarily we have created static
utility classes that hold the sort for each collection and return the
collection so that the sort can be applied via this method
<mx:TileList dataProvider="{PeopleSort.byName(MyParty.people)}" />
The people sort class is structured like this
public class PeopleSort
{
public static function byName(collection: ArrayCollection) :
ArrayCollection {
collection.sort = new Sort();
collection.sort.fields = [new SortField("firstName"),new SortField
("lastName")]
collection.refresh();
return collection;
}
Somehow this does not seem like the most elegant method, but we can't
seem to figure out a better way to do it.
- Kevin
On Dec 26, 2007, at 5:12 AM, simonjpalmer wrote:
This shifts the problem from one of
persistence and/or data architecture to one of display and the
solution for me was more obvious.