Just been through some TABLE() and SQLTABLE() work and could not find
a way (I was satisfied with) to change output results of particular
columns. For example, I have an sql column that is a color code and
I'd like to put in a css element with that color. The hard way is
obviously foregoing the {{=table}} and looping through all the
components, changing the ones you need, but this produces mighty ugly
views. Is there a more intelligent/recommended way of doing this ?
If not, I'd like to suggest something like a per-column map function,
similar to what we have for upload columns now. For example
SQLTABLE(result=result, map={'colorcol': mycolorfunc, 'linkcol' :
lambda x: A(_href=x), 'bigfloatcol' : lambda x: "%.2f" % x} )
The same could work for TABLE() if they have a header row to identify
columns.
This could be also useful for views, too, imagine:
{{table.map['badlyformattedcol'] = goodformatfunc}}
{{=table}}
Comments, suggestions, recommendations ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---