1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 Using a made-up xmlns..
7 <html xmlns:
mochi=
"http://mochikit.com/examples/ajax_tables">
9 <title>Sortable Tables from Scratch with MochiKit
</title>
10 <link href=
"ajax_tables.css" rel=
"stylesheet" type=
"text/css" />
11 <script type=
"text/javascript" src=
"../../MochiKit/MochiKit.js"></script>
12 <script type=
"text/javascript" src=
"ajax_tables.js"></script>
16 Sortable Ajax Tables in JSON and XML with MochiKit
21 This is an example of how one might use
<a href=
"http://mochikit.com/">MochiKit
</a> to do
22 sortable tables from data given by the server in either JSON
23 or XML format. It uses
24 <a href=
"../../doc/html/MochiKit/Async.html">MochiKit.Async
</a>
25 to fetch the data, and
26 <a href=
"../../doc/html/MochiKit/DOM.html">MochiKit.DOM
</a>
30 Includes a micro implementation of something
31 <a href=
"http://www.zope.org/Wikis/DevSite/Projects/ZPT/FrontPage">TAL
</a>-esque
32 (called
"MochiTAL" in the source, using a mochi: namespace).
33 For a more detailed description of what happens under the
34 covers, view the
<a href=
"ajax_tables.js" class=
"view-source">ajax_tables.js
</a>
35 source and look at the comments.
41 <a href=
"index.html" class=
"view-source">index.html
</a> |
42 <a href=
"ajax_tables.js" class=
"view-source">ajax_tables.js
</a> |
43 <a href=
"domains.json" class=
"view-source">domains.json
</a> |
44 <a href=
"domains.xml" class=
"view-source">domains.xml
</a>
49 <a href=
"domains.json" mochi:
dataformat=
"json">domains.json
</a>
50 |
<a href=
"domains.xml" mochi:
dataformat=
"xml">domains.xml
</a>
52 (current format:
<span class=
"mochi-template" mochi:
content=
"format">loading
</span>)
54 <table id=
"sortable_table" class=
"datagrid">
57 <th mochi:
sortcolumn=
"domain_name str">Domain Name
</th>
58 <th mochi:
sortcolumn=
"create_date isoDate">Creation Date
</th>
59 <th mochi:
sortcolumn=
"expiry_date isoDate">Expiry Date
</th>
60 <th mochi:
sortcolumn=
"organization_name istr">Organization Name
</th>
63 <tfoot class=
"invisible">
68 <tbody class=
"mochi-template">
69 <tr mochi:
repeat=
"item domains">
70 <td mochi:
content=
"item.domain_name">mochibot.com
</td>
71 <td mochi:
content=
"item.create_date">2005-
02-
10</td>
72 <td mochi:
content=
"item.expiry_date">2007-
02-
10</td>
73 <td mochi:
content=
"item.organization_name">Jameson Hsu
</td>
75 <tr class=
"mochi-example">
76 <td>pythonmac.org
</td>
81 <tr class=
"mochi-example">
82 <td>undefined.org
</td>
85 <td>Robert J Ippolito
</td>
87 <tr class=
"mochi-example">
91 <td>Python Software Foundation
</td>