Re: [web2py] Re: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Richard Vézina
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

Re: [web2py] Re: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Niphlod
yep. you would have to fetch those fields for searching through them anyway. On Wednesday, May 1, 2013 4:54:28 PM UTC+2, Richard wrote: 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

Re: [web2py] Re: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Richard Vézina
This is faster I guest then making a lambda db query each record each request... I post an other thread about SQLFORM.grid() and search if you want to comment... Thanks Richard On Wed, May 1, 2013 at 3:35 PM, Niphlod niph...@gmail.com wrote: yep. you would have to fetch those fields for

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Cliff Kachinske
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)

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Niphlod
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,

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Cliff Kachinske
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

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread weheh
Thanks for the responses. @Niphlod: I'm not sure what you mean by a full queryset. Can you elaborate, please? --

Re: [web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Bruno Rocha
Basically you have to keep in mind that 'orderby and limitby will be done by the database engine, the db does not know anything about your lambda' logic. --

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Niphlod
again, it seems to work but I didn't check the code to see if it is supported. when you pass a table to the grid constructor, search, orderby etc are done against the real data of the table. So, if you're going to display, e.g., a table with a user_id fields referenced to the auth_user table,

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread weheh
OK, so I guess the answer is to ditch the virtual field and go with a regular field, then compute the field before putting up the grid. Lambda is nice in my failed implementation because it iterates automatically. I wonder if I can do the assignment without having to loop while updating? In

[web2py] Re: grid not ordering lambda-generated column values correctly

2012-08-06 Thread Niphlod
really 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