I think you want:
{extend 'layout.html'}}
<h1>{{=targetList.title}}</h1>
{{
td=lambda value: TD(value,_style="text-align:left;vertical-align:top")
tbody=TBODY()
for targ in targets:
tbody.append(TR(td(targ.priority), td(targ.pctObs),
td(targ.name),td(targ.status), td(targ.comment))
pass
=TABLE(THEAD(TR(TH('Priority'), TH('PCT'), TH('Name'),
TH('Status'),TH('Comments')), _align='left'), tbody)
}}
But this would be better handled via CSS
td { text-align: left; vertical-align: top }
On 3 Lug, 19:19, Christian <[email protected]> wrote:
> Hi,
>
> In one of my default views, I want to display a table of data. I'd
> like to have the header text left-aligned in the cells, however I
> cannot get it to display like I want it. The code is:
>
> {{extend 'layout.html'}}
> <h1>{{=targetList.title}}</h1>
> {{body=''}}
> {{for targ in targets:}}
> {{body=TR(TD(targ.priority), TD(targ.pctObs), TD(targ.name),
> TD(targ.status), TD(targ.comment))}}
> {{pass}}
> {{=TABLE(THEAD(TR(TH('Priority'), TH('PCT'), TH('Name'), TH('Status'),
> TH('Comments')), _align='left'), TBODY(body))}}
>
> where 'body' has been generated in previous part of the code. It
> displays the table, however it does not left align the text in the
> header cells. One thing to note is that I tried explicitly writing out
> the HTML I wanted, and the none of the HTML attributes seem to be
> working, e.g. border. The only thing I got to work was right aligning
> the entire table, but if I use the same code that does this and simply
> replace the _align="right" with _align="center", it won't even center
> the entire table. Does anyone know how to fix this?