changeset 3:0e2d167d0983

nicer html table with id
author casties
date Wed, 02 Jun 2010 15:44:03 +0000
parents 61a3764cd5fb
children e3ee1f358fe6
files zpt/HTML_table.zpt
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/zpt/HTML_table.zpt	Fri May 21 11:48:30 2010 +0000
+++ b/zpt/HTML_table.zpt	Wed Jun 02 15:44:03 2010 +0000
@@ -1,4 +1,5 @@
-<html tal:define="format python:request.get('format','table'); fields options/data/names">
+<html tal:define="format python:request.get('format','table'); table_id python:request.get('table_id',None); 
+    fields options/data/names">
   <head>
     <title tal:content="template/title">The title</title>
     <meta http-equiv="content-type" content="text/html;charset=utf-8">
@@ -6,13 +7,17 @@
   <body>
     <h2>table <span tal:replace="options/tablename"/></h2>
     <tal:block tal:condition="python:format=='table'">
-    <table id="table">
-      <tr>
-	<th tal:repeat="field fields" tal:content="field"/>
-      </tr>
-      <tr tal:repeat="row options/data">
-	<td tal:repeat="field fields" tal:content="python:row[field]"/>
-      </tr>
+    <table tal:attributes="id table_id">
+      <thead>
+        <tr>
+	      <th tal:repeat="field fields" tal:content="field"/>
+        </tr>
+      </thead>
+      <tbody>
+        <tr tal:repeat="row options/data">
+	      <td tal:repeat="field fields" tal:content="python:row[field]"/>
+        </tr>
+      </tbody>
     </table>
     </tal:block>
   </body>