[CDBI] Ordering by a foreign column

[prev] [thread] [next] [Date index for 2005/11/21]

From: Ken Youens-Clark
Subject: [CDBI] Ordering by a foreign column
Date: 21:00 on 21 Nov 2005
Hi,

I've been hacking the "Hops" Catalyst sample CRUD application for my  
own evil purposes, and I've gotten lots of stuff working relatively  
easy.  For a couple of days, however, I've been stuck on how to get  
my "list" view of a table to be able to sort on any of the columns  
shown, including those from a foreign table (e.g., the "stringified"  
version of a foreign key).  My model classes are based on Class::DBI,  
of course, so I'm writing here to ask for guidance.

I Googled and found a similar thread ("order by a foreign key") from  
back in August of this year:

	http://lists.digitalcraftsmen.net/pipermail/classdbi/2005-August/ 
000065.html

I've followed through all the suggestions and have tried various  
plugins and extensions such as Class::DBI::Sweet, Class::DBI::Pager,  
Class::DBI::Plugin::Pager and Class::DBI::Plugin::RetrieveAll.  Of them:

Class::DBI::Sweet - doesn't work as advertised;  I can't get any  
sorting whatsoever to work, either on a column in the table or an  
expanded column;  actually, this module produces invalid SQL when I  
specify the "prefetch" (the arg of which should be an arrayref, not  
noted in the docs), and it seems to check the "has_a" and  
"might_have" meta_info incorrectly

Class::DBI::Pager - very cool, works great, but doesn't give me sorting

Class::DBI::Plugin::Pager - the Hops app uses this, but it doesn't  
seem to work at all for me;  it claims to handle sorting, but neither  
sorts on a table's columns or related tables' columns;  nor does it  
page the data as shown in the SYNOPSIS

Class::DBI::Plugin::RetrieveAll - works perfectly, but only for  
columns in the table

I'm really at a loss here for how to get this working.  I want my  
users to be able to sort by every column presented in a list view.   
Can anyone point me in the right direction?

ky

PS - I sent this last week to "cdbi-talk@xxxxxx.xxxxx.xxx," but never  
saw it posted, so I'm sending again.

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Ordering by a foreign column
Ken Youens-Clark 21:00 on 21 Nov 2005

Re: [CDBI] Ordering by a foreign column
Matt S Trout 21:14 on 21 Nov 2005

Generated at 14:51 on 01 Dec 2005 by mariachi v0.52