First I assume you have implemented a method called ascending on your
object. Because it is going to get called if you sort in this way.
In WO3.5.1 you would do:
aVector.sortUsingMethod( new Selector("ascending"));
In WO4 NSArray has a similar method and usage
Also, note that EOSortOrdering in WO4 has some class methods that let
you sort NSDictionaries and/or EOs in your arrays using an array of sort
oderings...
aSortedArray =
EOSortOrdering.sortedArrayUsingKeyOrderArray(objectsToSort,
arrayOfSortOrderings);
You create a EOSortOrdering like:
aOrdering = new EOSortOrdering("firstName",
EOSortOrdering.CompareAscending);
d
Soc Lang Thang wrote:
>
> Hi All,
>
> Thank you for your responses to my previous post...
>
> I got another question to ask you guys!!! I need to sort a mutable
> vector using the sortUsingMethod. The documentation said:
>
> ...
>
> public void sortUsingMethod(java.lang.String comparator)
>
> Sorts the receiver's elements in ascending order, as determined by the
> comparison method named by comparator. The comparator message is sent to
> each object in the vector, and has as its single argument another object
> in the vector. The comparator method is used to compare two elements at
> a time and should return -1 if the receiver is smaller than the
> argument, 1 if the receiver is larger than the argument, and 0 if they
> are equal.
>
> ...
>
> Well, I passed in a string, let say "ascending" (sorry, I am a bit
> clueless), the compiler, then complains "Incompatible type for method.
> Can't conver java.lang.String to next.util.Selector". Huh??? I thought
> the documentation asks me to pass in a string !??? Okay, fine! I will
> pass in a next.util.Selector, but, there is no documentation for
> next.util.Selector. If you have experience using this method, or know
> where documentation for next.util.Selector is, please give my some
> pointer!
>
> many thanks!
> Get Your Private, Free Email at http://www.hotmail.com