Hi, 

I solved it putting the foreing key format in the controller, before the 
grid:

def familia_manage():
    *db.auth_user._format = '%(last_name)s %(first_name)s'*
    fields=[db.t_familiares.f_nombre, 
db.t_familiares.f_apellidos,db.t_familiares.f_titular]
    form = SQLFORM.grid(db.t_familiares, fields=fields )
    return locals()

Where, in the table declaration:

db.t_familiares.f_titular.requires= 
(IS_IN_DB(db,'auth_user.id','%(last_name)s ''%(first_name)s'))

When I press the header I get it order by last_name instead of id.


El lunes, 21 de mayo de 2012 22:24:23 UTC+2, backseat escribió:
>
> Thanks Jim, I somehow missed the 'orderby' parameter to SQLFORM.grid 
>
> On Mon, 21 May 2012 13:11:31 -0700 (PDT), massimo....@gmail.com 
> <javascript:> said: 
>
> > foreign key. You can do a join. 
>
> Thanks Massimo; however, that's a little cryptic. Could you explain how a 
> join can be used to determine the sort order when I click on a 
> SQLFORM.grid header? 
>
> Thanks, 
> Keith 
> -- 
> "You can have everything in life you want if you help enough other people 
> get what they want" - Zig Ziglar. 
>
> Who did you help today? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to