So, if I do understand correctly the Niphold explanation if I want to search for instance the first_name of the auth_user table that is referenced from my table I can't just pass the to SQLFORM.grid my_table, I better pass it a join query where all the represent are replaced with the really field of the referenced table, right?
Richard On Mon, Aug 6, 2012 at 4:25 PM, Niphlod <niph...@gmail.com> wrote: > reeeeeally don't know if this is officially supported or not, but works in > a test I just made. > > > On Monday, August 6, 2012 10:06:44 PM UTC+2, Cliff Kachinske wrote: >> >> Maybe I missed something here. >> >> I know you can pass a query to grid. By queryset do you mean a set of >> row objects? >> >> On Monday, August 6, 2012 3:56:12 PM UTC-4, Niphlod wrote: >>> >>> this is more related to an implementation logic than a bug. >>> >>> fields that are represented by some other field gets computed at >>> run-time, but to search/orderby them you have to fetch them too, and that >>> can be expensive. >>> >>> If you need to orderby/search by a referenced/represented/**computed >>> field, you can pass the full queryset to the grid. >>> >>> On Monday, August 6, 2012 9:07:59 PM UTC+2, Cliff Kachinske wrote: >>>> >>>> Me too. It's one of the reasons I don't use grid/smartgrid. >>>> >>>> Sorry I don't have an answer. >>>> >>>> On Monday, August 6, 2012 10:18:07 AM UTC-4, weheh wrote: >>>>> >>>>> I have an SQLFORM.grid(... orderby=db.host.id ...) where >>>>> db.host.id.represent=lambda value, row: int( >>>>> db((db.url_queue.host_id == value) & (db.url_queue.removed == >>>>> None)).count() >>>>> ) >>>>> >>>>> The host.id column displays the correct numbers, but when I click on >>>>> the column title to order ascending or descending, the order is seemingly >>>>> random. I suspect it's ordering not by the lambda value, but rather by the >>>>> underlying host.id value. Seems like a bug ...? >>>>> >>>> -- > > > > -- --- 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/groups/opt_out.