The "represent" attribute is used by SQLFORM, SQLFORM.grid, and SQLTABLE 
but does not automatically get applied otherwise. You can also apply it by 
calling the .render() method on the Rows object, as documented here: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Rendering-rows-using-represent

Anthony 

On Monday, December 29, 2014 8:19:53 PM UTC-5, Alex Glaros wrote:
>
> what is syntax for "represents" statement for this controller-styled table?
>
> def list_users():
>     btn = lambda row: A("Edit", _href=URL('manage_user', args=
> row.auth_user.id))
>     db.auth_user.edit = Field.Virtual(btn) 
>     rows = db(db.auth_user).select()
> ## TRIED THIS:    db.auth_user.first_name.represent = lambda v, r: 
> A(r.created_by.first_name, ' ', r.created_by.last_name, 
> _href=URL('view_user_profile', args=r.created_by)) 
> ## TRIED THIS:    rows.auth_user.first_name.represent = lambda v, r: 
> A(r.created_by.first_name, ' ', r.created_by.last_name, 
> _href=URL('view_user_profile', args=r.created_by)) 
>     headers = ["ID", "Name", "Last Name", "Email", "Edit"]
>     fields = ['id', 'first_name', 'last_name', "email", "edit"]
>     table = TABLE(THEAD(TR(*[B(header) for header in headers])),
>                   TBODY(*[TR(*[TD(row[field]) for field in fields]) \
>                         for row in rows]))
>     table["_class"] = "table table-striped table-bordered table-condensed"
>     return dict(table=table)
>
>
> thanks,
>
> Alex Glaros
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to