do TAG.TH instead of TH

On 27 Apr, 04:59, Timmie <timmichel...@gmx-topmail.de> wrote:
> I liked this option most.
>
> Here is the function I derived from this:
>
> def rows_transpose(rows_obj):
>     """transposes a rows object
>
>     input:    a rows object selected from the data base
>     output:   a html table of the transposed table
>
>     This can still be improved by using the headers attribute of the
>     SQLTABLE and a CSS alogn attribute
>     """
>
>     tbody=[]
>     for col in rows_obj.colnames:
>         fld=col.split('.')[1]
>         r=[TH(col,_scope='row', _style="text-align : left")]
>         for row in rows_obj:
>             r.append(TD(row[fld]))
>         tbody.append(TR(r))
>     res_table=TABLE(tbody)
>
>     return res_table
>
> Although the numpy version was faster, this function gives more
> control over the html output.
>
> I would be great if such a functionality could be included in web2py!
>
> I still have the following questions:
>
> * How can I retrieve and use the default field lables set in the model
> as colnames?
> * When I put this function in an extra module file and save this in
> applications.myapp.helper.py
> I get the following error:
>
> File "applications\myapp\modules\helper.py", line 27, in
> rows_transpose
> r=[TH(col,_scope='row', _style="text-align : left")]
> NameError: global name 'TH' is not defined
>
> Why this? How can I have modules which are awar of the web2py
> namespace in the modules folder?
> Or shall I leave such helper functions in the default.py?
>
> Regards,
> Timmie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to