Debian Codegraph @

docs/example-option-render-template.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Header Template &amp; Rendering</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 // call the tablesorter plugin
22 $("table").tablesorter({
23 theme : 'blue',
24
25 // {icon} isn't used by the blue theme; it is optional here
26 headerTemplate : '{icon}{content}',
27 // manipulate the template string after is it created
28 onRenderTemplate : function(i, t) {
29 // add the column number to the beginning
30 // it's a zero-based index, so we add one
31 return '<em>' + (i+1) + ':</em> ' + t;
32 }
33 });
34 });</script>
35 </head>
36 <body>
37
38 <div id="banner">
39 <h1>table<em>sorter</em></h1>
40 <h2>Header Template &amp; Rendering</h2>
41 <h3>Flexible client-side table sorting</h3>
42 <a href="index.html">Back to documentation</a>
43 </div>
44
45 <div id="main">
46
47 <p class="tip">
48 <em>NOTE!</em> These options were added in version 2.7 (they are not part of the original plugin).
49 </p>
50
51 <h1>Demo</h1>
52 <div id="demo"><table class="tablesorter">
53 <thead>
54 <tr>
55 <th>First Name</th>
56 <th>Last Name</th>
57 <th>Age</th>
58 <th>Total</th>
59 <th>Discount</th>
60 <th>Date</th>
61 </tr>
62 </thead>
63 <tbody>
64 <tr>
65 <td>Peter</td>
66 <td>Parker</td>
67 <td>28</td>
68 <td>$9.99</td>
69 <td>20%</td>
70 <td>Jul 6, 2006 8:14 AM</td>
71 </tr>
72 <tr>
73 <td>John</td>
74 <td>Hood</td>
75 <td>33</td>
76 <td>$19.99</td>
77 <td>25%</td>
78 <td>Dec 10, 2002 5:14 AM</td>
79 </tr>
80 <tr>
81 <td>Clark</td>
82 <td>Kent</td>
83 <td>18</td>
84 <td>$15.89</td>
85 <td>44%</td>
86 <td>Jan 12, 2003 11:14 AM</td>
87 </tr>
88 <tr>
89 <td>Bruce</td>
90 <td>Almighty</td>
91 <td>45</td>
92 <td>$153.19</td>
93 <td>44%</td>
94 <td>Jan 18, 2001 9:12 AM</td>
95 </tr>
96 <tr>
97 <td>Bruce</td>
98 <td>Evans</td>
99 <td>22</td>
100 <td>$13.19</td>
101 <td>11%</td>
102 <td>Jan 18, 2007 9:12 AM</td>
103 </tr>
104 </tbody>
105 </table></div>
106
107 <h1>Javascript</h1>
108 <div id="javascript">
109 <pre class="prettyprint lang-javascript"></pre>
110 </div>
111 <h1>HTML</h1>
112 Before
113 <div>
114 <pre class="prettyprint lang-html">&lt;thead&gt;
115 &lt;tr&gt;
116 &lt;th&gt;First Name&lt;/th&gt;
117 &lt;th&gt;Last Name&lt;/th&gt;
118 &lt;th&gt;Age&lt;/th&gt;
119 &lt;th&gt;Total&lt;/th&gt;
120 &lt;th&gt;Discount&lt;/th&gt;
121 &lt;th&gt;Date&lt;/th&gt;
122 &lt;/tr&gt;
123 &lt;/thead&gt;</pre>
124 </div>
125 After
126 <div>
127 <pre class="prettyprint lang-html">&lt;thead&gt;
128 &lt;tr class=&quot;tablesorter-headerRow&quot;&gt;
129 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;1:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;First Name&lt;/div&gt;&lt;/th&gt;
130 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;2:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;Last Name&lt;/div&gt;&lt;/th&gt;
131 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;3:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;Age&lt;/div&gt;&lt;/th&gt;
132 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;4:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;Total&lt;/div&gt;&lt;/th&gt;
133 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;5:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;Discount&lt;/div&gt;&lt;/th&gt;
134 &lt;th class=&quot;tablesorter-header&quot;&gt;&lt;div class=&quot;tablesorter-header-inner&quot;&gt;&lt;em&gt;6:&lt;/em&gt; &lt;i class=&quot;tablesorter-icon&quot;&gt;&lt;/i&gt;Date&lt;/div&gt;&lt;/th&gt;
135 &lt;/tr&gt;
136 &lt;/thead&gt;</pre>
137 <small>* Note: the tablesorter-icon was only added for emphasis in this demo, it isn't used at all by the blue template.</small>
138 </div>
139
140 <div class="next-up">
141 <hr />
142 Next up: <a href="example-triggers.html">Triggers sortEnd and sortStart &rsaquo;&rsaquo;</a>
143 </div>
144
145 </div>
146
147 </body>
148 </html>