Skip to content

Commit

Permalink
creating tables dynamically and make them sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Bach committed Nov 30, 2011
1 parent abb7d60 commit edbaf97
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions taunus/templates/directory.pt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="base">
<tal:block metal:fill-slot="body">
<div class="data spec">
<table>
<tr>
<th>File</th>
</tr>
<tr tal:repeat="item resource">
<td><a href="${item.path}">${item}</a></td>
</tr>
</table>
<div id="dirlisting" class="data spec">
</div> <!-- closes data -->
<script>
YUI().use('datatable', function (Y) {
var cols = [
{ key: "name", label: "Name", abbr: "name", sortable: "true" },
{ key: "size", label: "Size", abbr: "size", sortable: "true" }
];
var data = [
<tal:block tal:repeat="item resource">
{"name": "<a href='${item.path}'>${item}</a>", "size": ${item.size}},
</tal:block>
];
var table = new Y.DataTable.Base({
columnset: cols,
recordset: data
}).plug(Y.Plugin.DataTableSort).render("#dirlisting");
});
</script>
</tal:block>
</html>

0 comments on commit edbaf97

Please sign in to comment.