I found a solution:
db.protocol.region.represent = lambda v,r: str(r.protocol.region) + '-' +
str(r.protocol.sequence) + '/' + str(r.protocol.year)
In the controller, you must also set readable to false for
db.protocol.sequence and db.protocol.year , and they must be present in the
grid´s field parameter (and only db.protocol.region must be present in the
grid´s headers parameter)
Fred
On Wednesday, May 29, 2013 11:44:45 AM UTC-3, Fred Guedes Pereira wrote:
>
> Hi,
>
> Is there a way to group two or more table fields in the same column of a
> SQLFORM.smartgrid?
>
> Consider this model, as an example:
>
> db.define_table("protocol",
> Field("region", "integer"),
> Field("sequence", "integer"),
> Field("year", "integer"),
> Field("details", "string"))
>
> The fields region + sequence + year should get together in the same column
> of the smartgrid (formated as "region-sequence/year", p.e.). I tryed with
> VirtualFields, but they do not appear in smartgrids.
>
> One more doubt: is it possible to hide that link (with the table name in
> plural) that smartgrids generate above the search panel?
>
> thank you,
> Fred
>
--
---
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/groups/opt_out.