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 ...? >>>> >>> --