Tables and grids have a "headers" parameter.
It's a dictionary where the key is the header in the form 
"tablename.fieldname" and value is the header representation.

For example with:

headers = dict((str(header), B(EM(header.label))) for header in db.tablename
)
table = SQLTABLE(rows, headers=headers)

the headers in the table will be rendered in bold and italic.

In your specific case you could do (for each header):

headers['tablename.fieldname'] = IMG(_src=URL('static/images','an_image.png'
), _alt=str(db.tablename['fieldname'].label))

where tablename, fieldname and the source image should be replaced with 
your own.





 

Il giorno domenica 4 novembre 2012 08:09:28 UTC+1, Simon Ashley ha scritto:
>
> Have a requirement to produce grids / tables with icons rather than label 
> headers. 
> In messing around, haven't come up with a good solution, and looking for 
> ideas 
> (header labels are are normally translated as a strings). 
>
> Would manipulated the grid / table variable before return it as a dict be 
> the logical way to go? 
> TIA.
>
>
>
> <https://lh3.googleusercontent.com/-mYTlETqpXKQ/UJYUKAQsCDI/AAAAAAAAAGY/YTEWtOloVrg/s1600/grid+header+as+icons.png>
> Or is there something simpler?
>

-- 



Reply via email to