Debian Codegraph @

docs/example-options-headers.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Disable sort</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 // BONUS TIP: disable a column using jQuery data directly
23 // but do it before the table initializes
24 // this code disables the sort on the "Date" column
25 $("table thead th:eq(5)").data("sorter", false);
26
27 $("table").tablesorter({
28 theme : 'blue',
29
30 headers: {
31 // disable sorting of the first & second column - before we would have to had made two entries
32 // note that "first-name" is a class on the span INSIDE the first column th cell
33 '.first-name, .last-name' : {
34 // disable it by setting the property sorter to false
35 sorter: false
36 }
37 }
38 });
39 });</script>
40 </head>
41 <body>
42 <div id="banner">
43 <h1>table<em>sorter</em></h1>
44 <h2>Disable sort</h2>
45 <h3>Flexible client-side table sorting</h3>
46 <a href="index.html">Back to documentation</a>
47 </div>
48 <div id="main">
49
50 <p class="tip">
51 <em>NOTE!</em>
52 </p>
53 <ul>
54 <li>In tablesorter <span class="version">v2.18.1</span>, you can now target a column by the class name of an element inside of a header; note that the span has the targeted class name in the first name column.</li>
55 <li>In tablesorter v2.0.5 and older, only the metadata and headers options methods were available.</li>
56 <li>In versions 2.3+, columns can be disabled using any of the following methods (they all do the same thing), in order of priority:
57 <ul>
58 <li>jQuery data <code>data-sorter="false"</code> (see the Javascript block below on how to set it directly).</li>
59 <li>metadata <code>class="{ sorter: false }"</code>. This requires the metadata plugin.</li>
60 <li>headers option <code>headers : { 0 : { sorter: false } }</code>.</li>
61 <li>header class name <code>class="sorter-false"</code>.</li>
62 </ul>
63 </li>
64 </ul>
65
66 <h1>Demo</h1>
67 <div id="demo"><table class="tablesorter">
68 <thead>
69 <tr>
70 <th><span class="first-name">First Name</span></th>
71 <th class="last-name">Last Name</th>
72 <th data-sorter="false">Age</th>
73 <th>Total</th>
74 <th class="sorter-false">Discount</th>
75 <th>Date</th>
76 </tr>
77 </thead>
78 <tbody>
79 <tr>
80 <td>Peter</td>
81 <td>Parker</td>
82 <td>28</td>
83 <td>$9.99</td>
84 <td>20%</td>
85 <td>Jul 6, 2006 8:14 AM</td>
86 </tr>
87 <tr>
88 <td>John</td>
89 <td>Hood</td>
90 <td>33</td>
91 <td>$19.99</td>
92 <td>25%</td>
93 <td>Dec 10, 2002 5:14 AM</td>
94 </tr>
95 <tr>
96 <td>Clark</td>
97 <td>Kent</td>
98 <td>18</td>
99 <td>$15.89</td>
100 <td>44%</td>
101 <td>Jan 12, 2003 11:14 AM</td>
102 </tr>
103 <tr>
104 <td>Bruce</td>
105 <td>Almighty</td>
106 <td>45</td>
107 <td>$153.19</td>
108 <td>44%</td>
109 <td>Jan 18, 2001 9:12 AM</td>
110 </tr>
111 <tr>
112 <td>Bruce</td>
113 <td>Evans</td>
114 <td>22</td>
115 <td>$13.19</td>
116 <td>11%</td>
117 <td>Jan 18, 2007 9:12 AM</td>
118 </tr>
119 </tbody>
120 </table></div>
121
122 <h1>Javascript</h1>
123 <div id="javascript">
124 <pre class="prettyprint lang-javascript"></pre>
125 </div>
126 <h1>HTML</h1>
127 <div id="html">
128 <pre class="prettyprint lang-html"></pre>
129 </div>
130
131 <div class="next-up">
132 <hr />
133 Next up: <a href="example-options-headers-locked.html">Lock sort order using header options &rsaquo;&rsaquo;</a>
134 </div>
135
136 </div>
137
138 </body>
139 </html>