Question

How do I create a table with alternating row highlighting using Mako? What is the mako syntax, and what do I put into the css file?

I followed the pyramid tutorial to build my own app, but I am stuck creating a good browser based user interface.

Was it helpful?

Solution

I assume you have data in list

<table>
            <tr>
                      <th>Column1</th>
                      <th>Column2</th>
                      <th>Column3</th>

            </tr>
            % for line in table_lines:
                      % if <check condition>:
                          <tr background="black">
                      % else:
                          <tr background="white">
                      % endif

                      <td>${line.column1}</p>
                      <td>${line.column2}</td>
                      <td>${line.column3}</td>
                      </tr>
            % endfor
    </table>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top