Re: Custom EOSortOrdering for a WODisplayGroup
Re: Custom EOSortOrdering for a WODisplayGroup
- Subject: Re: Custom EOSortOrdering for a WODisplayGroup
- From: Mark Wardle <email@hidden>
- Date: Thu, 6 May 2010 12:03:10 +0100
This may be naive but could you create a derived property and sort on
that?
Presumably this could be java based for in memory sorts or implemented
within your database if db sorts were required?
--
Dr. Mark Wardle
Specialist registrar, Neurology
(Sent from my mobile)
On 6 May 2010, at 11:29, Paul Hoadley <email@hidden> wrote:
On 06/05/2010, at 4:41 PM, Timo Hoepfner wrote:
I did something similar before. I basically took the "Strings"
class from here:
<http://weblogs.java.net/blog/skelvin/archive/2006/01/natural_string.html
>
and wired it up in a EOSortOrdering.ComparisonSupport subclass
derived from ERXComparisonSupport. I attached a cleaned up version
of the file.
Then add something like this to your Application (if it extends
ERXApplication):
@Override
public void finishInitialization() {
super.finishInitialization();
NaturalOrderStringSortSupport.initialize();
}
As Johann pointed out before, this is then globally used for all
String sorting.
Thanks Timo. Very helpful.
If the list could just bear with me for a little longer... I take
it that I've fundamentally misunderstood what an EOSortOrdering is
doing. When I wanted to create an EOSortOrdering that sorts in some
particular way _on some particular EO's attribute_, there's actually
no such thing—right? An EOSortOrdering takes a key, but then sorts
in a pre-defined way based on the type of the key (and the NSSelecto
r supplied)—right? So I've really only got the following options:
1. Take Timo and Johann's advice, and implement a custom sorting
algorithm that would be used globally for all Strings.
2. Change the Java type of that attribute to some custom type (that
presumably includes a String by composition), implement the sorting
algorithm for that type, and register that for global use as
described. (Is that even feasible? Sounds like a lot of work.)
3. Stick with the current hack that will break if the attribute
value can't be cast to an Integer.
Any other options? Or do I sound completely insane?
--
Paul.
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@wardle.org
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden