Here is one way to do it:
For the object associated with the column you want to sort, you
override the comparable method. I am not sure if there is an existing
JDK Object for "case-insensitive String", but you could create one.
Overriding comparable is how you do the custom sorting. There are
probably other ways of doing this.
Stolen from the web:
public final class CaseInsensitiveString implements Comparable {
private String s;
public CaseInsensitiveString(String s) {
if (s == null)
throw new NullPointerException();
this.s = s;
}
public boolean equals(Object o) {
return o instanceof CaseInsensitiveString &&
((CaseInsensitiveString)o).s.equalsIgnoreCase(s);
}
// Lazily initialized, cached hashCode - page 40
private volatile int hashCode = 0; // (See Item 48)
public int hashCode() {
if (hashCode == 0)
hashCode = s.toUpperCase().hashCode();
return hashCode;
}
public int compareTo(Object o) {
CaseInsensitiveString cis = (CaseInsensitiveString)o;
return String.CASE_INSENSITIVE_ORDER.compare(s, cis.s);
}
public String toString() {
return s;
}
}
On Wed, Jul 30, 2008 at 6:15 AM, Moritz Gmelin <[EMAIL PROTECTED]> wrote:
> Hi,
>
> If I wanted to change the sorting system of a grid colum. e.g ignore
> lower/uppercase for sorting.
> How could I do this?
>
> Regards
>
> Moritz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]