This use case keeps on haunting me... :)
Sometimes i want to hide columns from a smartgrid but I still want to be
able to search for them AND use it within the SQLFORM links parameter, like
the 'fingerprint' parameter in the following example:
in model:
db.define_table('mytable',
Field('name'),
Field('score'),
Field('fingerprint'))
in controller I would have a function with:
db.mytable.fingerprint.represent = False # this will hide 'fingerprint'
column but will also render it unusable from within links= parameter
grid = SQLFORM.smartgrid(db.mytable,links=[lambda row: SPAN(
A(callback=URL('update_fingerprint', args=['fixed',
*row.fingerprint*])))], # <- row.fingerprint will break
fields=[db.mytable.name, db.mytable.score],
searchable=[db.mytable.tool_id, db.mytable.name, db.mytable.
fingerprint])
Thanks in advance
P.S.: I have actually wrote about this before in this group at
https://groups.google.com/d/topic/web2py/EPO9RychvF4/discussion but I do
not like my own solution for obvious reasons. Note that the other reply in
that thread does not solve the problem since it does nothing to hide a
column.
--
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.