Hi Ian,

I added in the order sub. If I simply list my fruit table, 
it is sorted alphabetically by fruit name which is good.

The problem occurs when another table just stores the fruit id, 
and I join across to the fruit table to replace the id with 
the full name.

For example in table orders

quantity  fruit_id

10        2
5         1
4         3


MyApp::Orders->has_a(fruit_id => "MyApp::Fruits");

A select list built from fruit_id will still display

Apple
Banana 
Pear 
Orange

even with an order sub in place for fruits

Regards,

Kim





Ian VanDerPoel wrote:

>Kim,
>
>You need to overide the ORDER method for that table. Something like:
>
>sub order {
>    my ($self, $r) = @_;
>    return ($self->SUPER::order($r) || 'fruit' );
>}
>
>I hope this makes sense.
>
>Regards
>
>Ian
> 
>
>  
>
>>>>Kim Ryan <[EMAIL PROTECTED]> 13/07/06 3:37 PM >>>
>>>>        
>>>>
>HI all,
>
>I have some fairly long select lists to display. I use the has_a
>method so the contents of the select list are drawn from a database table.
>When I initially create the table I can control the sort sequence,  such as
>
>Apple, value = 1
>Banana, value = 2
>Pear, value = 3
>.....
>
>and they will appear in that order. A problem occurs when I
>want to add "Orange, value =4", it will be at the end of the list.
>
>Is there a way to have select lists sorted alphabetically?
>
>Thanks,
>
>Kim
>
>
>
>
>
>  
>



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to