[DAVEBAIRD - Tue Sep 20 06:28:31 2005]:
Show quoted text> [guest - Mon Sep 19 18:44:42 2005]:
>
> > select dropdowns are not sorted. This is a problem for me, as some
> of
> > my select lists are large and it's impossible to find anything.
> In
> > sub _field_options right before it returns, I added:
> >
> > @options = sort { $a->[1] <=> $b->[1] } @options;
> >
>
> This assumes all the labels are numbers. If they're not, you'll get
> lots
> of warnings. If you use cmp instead, there'll be no warnings, but if
> your labels are numbers, they'll come out in weird order ( 1, 11, 111,
> 12, 2 ...).
>
> It's definitely something that needs fixed though. I think there's
> some
> way of specifiying a default order in CDBI for retrieving records, but
> I
> don't know where to start looking. There also might be an option in
> CGI-FB.
>
> d.
There's a sortopts option in CGI::FB, but it also requires you to
specify whether to use text or numeric sorting, so it's not much help.
I didn't see anything in Class::DBI about a default sort order, but I'm
not sure it would help anyway. Since you'd be sorting by the
stringified object, you couldn't use database sorting in a lot of cases
(e.g., when using stringify_self). Anyhow, I've patched my own copy of
FB to use cmp on the values. Works well enough for me. At least I can
find things. Sure, numeric only lists are ugly looking, but oh well.