Thanks, I've got the alignment working properly now. Another question
I've come up with is concerning making my table sortable. I've found a
javascript file called "sorttable.js" that contains code that should
sort the table when you click on a header cell, based on the values in
that particular column. I've downloaded the .js file and placed in the
"static" folder in my application's directory. In the 'layout.html'
file, I've included it in the header section, like this:

<script type="text/javascript" src="sorttable.js">

and I've added _class="sortable" in the TABLE() line, with everything
else as before. However, this does not work. I'm wondering if it is
because the "sorttable.js" script is in the wrong folder. I tried
moving it to the same location as the "layout.html" file, but there
was no change. I'd appreciate any advice on how to get this working,
it seems like its a commonly used script.

On Jul 4, 12:41 am, mdipierro <[email protected]> wrote:
> 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?

Reply via email to