Re: WODisplayGroup sort question
Re: WODisplayGroup sort question
- Subject: Re: WODisplayGroup sort question
- From: Michael Engelhart <email@hidden>
- Date: Mon, 23 Aug 2004 16:17:40 -0500
One more question. I have one sort that needs to be done using an
NSComparator. What's the best way to handle that? i know how to sort
an array using a comparator but then I'm back to the code I have below
which doesn't appear to update my pages correctly.
THanks
MIke
On Aug 23, 2004, at 1:13 PM, Michael Engelhart wrote:
Thanks! That works perfectly.
Mike
On Aug 23, 2004, at 12:22 PM, Ruenagel, Frank wrote:
Hi,
what about this:
NSMutableArray sortOrderings = new NSMutableArray();
EOSortOrdering sortByName = new EOSortOrdering("name",
EOSortOrdering.CompareAscending);
sortOrderings.addObject(sortByName);
displayGroup.setSortOrderings(sortOrderings);
displayGroup.updateDisplayedObjects();
In WO-Builder bind to displayedObjects(), not to
allObjects().
HTH
Frank
-----Original Message-----
From: Michael Engelhart [mailto:email@hidden]
Sent: Monday, August 23, 2004 5:52 PM
To: WebObjectsDev
Subject: WODisplayGroup sort question
Hi -
I have a WODisplayGroup that I'm trying to sort but I can't
seem to get
it working.
Here's my code that does the sort/WODisplayGroup update:
NSArray sortedArray;
NSMutableArray sortOrderings = new NSMutableArray();
EOSortOrdering sortByName = new EOSortOrdering("name",
EOSortOrdering.CompareAscending);
sortOrderings.addObject(sortByName);
sortedArray =
EOSortOrdering.sortedArrayUsingKeyOrderArray(displayGroup.allO
bjects(),
sortOrderings);
displayGroup.setObjectArray(sortedArray);
The problem is that the data being displayed on the page isn't sorted
correctly. I read in previous posts that this is how you
should do it
but then in the WO API docs it says:
"Invoked from fetch to set the array of fetched objects;
should almost
never need to be invoked explicitly"
When I loop through the object array and print out the "name"
property,
the array of objects is sorted properly. Also the name
field is all
uppercase so it's not that I need to do a case insensitive sort.
Is there some kind of "update()" method that tells the WODIsplayGroup
to display new data? Not sure what it means but the data does come
back "changed", but it's not sorted correctly, it looks as if it's
partially sorted...there are sections that are sorted but
then every 10
or so items there's a name in say the "A"'s that starts with a W or
Z.
Thanks for any help.
Mike
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.