I have a grid that I would like to sort by a field that's removed from the
table referenced in the grid's query by two degrees of references. The
situation is essentially like this:
db.define_table('table1', ...)
db.define_table('table2', dal.Field('f_table1_id', type='reference table1',
label=current.T('Table1 ID'), ...)
db.define_table('table3', dal.Field('f_table2_id', type='reference table2',
label=current.T('Table2 ID'), dal.Field('field1', ...), ...)
I'd like to be able to do something like the following:
query = [some query referencing table1]
orderby = db.table1.id if not request.vars.orderby else db.table3.field1
grid = SQLFORM.grid(query, orderby = orderby)
In other words, I'd like to order a grid built from a query referencing
table1 by a field in table3. What's the best way to go about doing this?
Thank you.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.