Debian Codegraph @

docs/example-empty-table.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Initializing tablesorter on an empty table</title>
6
7 <!-- jQuery -->
8 <script src="js/jquery-latest.min.js"></script>
9
10 <!-- Demo stuff -->
11 <link rel="stylesheet" href="css/jq.css">
12 <link href="css/prettify.css" rel="stylesheet">
13 <script src="js/prettify.js"></script>
14 <script src="js/docs.js"></script>
15
16 <!-- Tablesorter: required -->
17 <link rel="stylesheet" href="../css/theme.blue.css">
18 <script src="../js/jquery.tablesorter.js"></script>
19
20 <script id="js">$(function() {
21
22 // Set up empty table with second and first columns pre-sorted
23 $("table").tablesorter({ theme : 'blue', sortList: [[2,1],[0,0]] });
24
25 $("#append").click(function() {
26
27 // add some html
28 var html = "<tr><td>Peter</td><td>Parker</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2006 8:14 AM</td></tr>" +
29 "<tr><td>John</td><td>Hood</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2002 5:14 AM</td></tr><tr><td>Clark</td>" +
30 "<td>Kent</td><td>18</td><td>$15.89</td><td>44%</td><td>Jan 12, 2003 11:14 AM</td></tr>" +
31 "<tr><td>Bruce</td><td>Almighty</td><td>45</td><td>$153.19</td><td>44%</td><td>Jan 18, 2001 9:12 AM</td></tr>";
32
33 // append new html to table body
34 $("table tbody").append(html);
35
36 // let the plugin know that we made a update, then the plugin will
37 // automatically sort the table based on the header settings
38 $("table").trigger("update");
39
40 return false;
41 });
42
43 });</script>
44 </head>
45 <body>
46
47 <div id="banner">
48 <h1>table<em>sorter</em></h1>
49 <h2>Initializing tablesorter on an empty table</h2>
50 <h3>Flexible client-side table sorting</h3>
51 <a href="index.html">Back to documentation</a>
52 </div>
53
54 <div id="main">
55
56 <p class="tip">
57 <em>NOTE!</em> The presorting of an empty table and automatic sorting of appended data was added in version 2.0.14 (not part of the original plugin).
58 </p>
59
60 <h1>Demo</h1>
61 <div id="demo"><table class="tablesorter">
62 <thead>
63 <tr>
64 <th>First Name</th>
65 <th>Last Name</th>
66 <th>Age</th>
67 <th>Total</th>
68 <th>Discount</th>
69 <th>Date</th>
70 </tr>
71 </thead>
72 <tbody>
73 </tbody>
74 </table>
75
76 <a href="#" id="append">Append new table data</a>
77 </div>
78
79 <h1>Javascript</h1>
80 <div id="javascript">
81 <pre class="prettyprint lang-javascript"></pre>
82 </div>
83 <h1>HTML</h1>
84 <div id="html">
85 <pre class="prettyprint lang-html"></pre>
86
87 <div class="next-up">
88 <hr />
89 Next up: <a href="example-ajax.html">Appending table data with ajax &rsaquo;&rsaquo;</a>
90 </div>
91
92 </div>
93
94 </div>
95
96 </body>
97 </html>