Debian Codegraph @

docs/example-ajax.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Appending table data with ajax</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 $("table").tablesorter({ theme : 'blue' });
23
24 $("#ajax-append").click(function() {
25
26 $.get("assets/ajax-content.html", function(html) {
27
28 // append the "ajax'd" data to the table body
29 $("table tbody").append(html);
30
31 // let the plugin know that we made a update
32 // the resort flag set to anything BUT false (no quotes) will trigger an automatic
33 // table resort using the current sort
34 var resort = true;
35 $("table").trigger("update", [resort]);
36
37 // triggering the "update" function will resort the table using the current sort; since version 2.0.14
38 // use the following code to change the sort; set sorting column and direction, this will sort on the first and third column
39 // var sorting = [[2,1],[0,0]];
40 // $("table").trigger("sorton", [sorting]);
41 });
42
43 return false;
44 });
45
46 });</script>
47 </head>
48 <body>
49
50 <div id="banner">
51 <h1>table<em>sorter</em></h1>
52 <h2>Appending table data with ajax</h2>
53 <h3>Flexible client-side table sorting</h3>
54 <a href="index.html">Back to documentation</a>
55 </div>
56
57 <div id="main">
58
59 <h1>Demo</h1>
60 <div id="demo"><table class="tablesorter">
61 <thead>
62 <tr>
63 <th>First Name</th>
64 <th>Last Name</th>
65 <th>Age</th>
66 <th>Total</th>
67 <th>Discount</th>
68 <th>Date</th>
69 </tr>
70 </thead>
71 <tbody>
72 <tr>
73 <td>Peter</td>
74 <td>Parker</td>
75 <td>28</td>
76 <td>$9.99</td>
77 <td>20%</td>
78 <td>Jul 6, 2006 8:14 AM</td>
79 </tr>
80 <tr>
81 <td>John</td>
82 <td>Hood</td>
83 <td>33</td>
84 <td>$19.99</td>
85 <td>25%</td>
86 <td>Dec 10, 2002 5:14 AM</td>
87 </tr>
88 <tr>
89 <td>Clark</td>
90 <td>Kent</td>
91 <td>18</td>
92 <td>$15.89</td>
93 <td>44%</td>
94 <td>Jan 12, 2003 11:14 AM</td>
95 </tr>
96 <tr>
97 <td>Bruce</td>
98 <td>Almighty</td>
99 <td>45</td>
100 <td>$153.19</td>
101 <td>44%</td>
102 <td>Jan 18, 2001 9:12 AM</td>
103 </tr>
104 <tr>
105 <td>Bruce</td>
106 <td>Evans</td>
107 <td>22</td>
108 <td>$13.19</td>
109 <td>11%</td>
110 <td>Jan 18, 2007 9:12 AM</td>
111 </tr>
112 </tbody>
113 </table>
114
115 <a href="#" id="ajax-append">Append new table data</a></div>
116
117 <p class="tip">
118 <em>NOTE!</em> With the latest version of jQuery, this demo will only work when the ajax page is hosted online.
119 </p>
120
121 <h1>Javascript</h1>
122 <div id="javascript">
123 <pre class="prettyprint lang-javascript"></pre>
124 </div>
125 <h1>HTML</h1>
126 <div id="html">
127 <pre class="prettyprint lang-html"></pre>
128 </div>
129
130 <div class="next-up">
131 <hr />
132 Next up: <a href="example-add-rows.html">Adding a table row &rsaquo;&rsaquo;</a>
133 </div>
134
135 </div>
136
137 </body>
138 </html>