| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Skip parsing of content</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-latest.min.js"></script> |
| 9 |
|
| 10 |
|
| 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 |
|
| 17 |
<link rel="stylesheet" href="../css/theme.blue.css"> |
| 18 |
<script src="../js/jquery.tablesorter.js"></script> |
| 19 |
|
| 20 |
<script> |
| 21 |
$(function() { |
| 22 |
$('table').on('tablesorter-initialized', function() { |
| 23 |
var i, j, t = [], |
| 24 |
cache = this.config.cache[0].normalized; |
| 25 |
for (i = 0; i < cache.length; i++) { |
| 26 |
t += '"' + cache[i].slice(0,3).join('", "') + '"\n'; |
| 27 |
} |
| 28 |
$('#cache pre').html(t); |
| 29 |
}); |
| 30 |
}); |
| 31 |
</script> |
| 32 |
|
| 33 |
<script id="js">$(function() { |
| 34 |
$("table").tablesorter({ |
| 35 |
theme : 'blue', |
| 36 |
|
| 37 |
// pass the headers argument and passing a object |
| 38 |
headers: { |
| 39 |
// disable sorter & parser for age column |
| 40 |
1: { sorter: false, parser: false } |
| 41 |
} |
| 42 |
|
| 43 |
}); |
| 44 |
});</script> |
| 45 |
|
| 46 |
</head> |
| 47 |
<body> |
| 48 |
<div id="banner"> |
| 49 |
<h1>table<em>sorter</em></h1> |
| 50 |
<h2>Skip parsing of content</h2> |
| 51 |
<h3>Flexible client-side table sorting</h3> |
| 52 |
<a href="index.html">Back to documentation</a> |
| 53 |
</div> |
| 54 |
<div id="main"> |
| 55 |
|
| 56 |
<p class="tip"> |
| 57 |
<em>NOTE!</em> |
| 58 |
</p> |
| 59 |
<ul> |
| 60 |
<li>In <span class="version">v2.17.1</span>, this parser setting was added to reduce the time needed to process the table content during initialization and updating.</li> |
| 61 |
<li><em>Disabling of the sorting</em> of the same column should be observed as sorting will not work without the parsed data.</li> |
| 62 |
<li><em>Disabling of filtering</em> of the same column may be necessary, especially if the data requires parsing when comparisons of data is required (e.g. looking for dates <code><</code>, <code><=</code>, <code>></code> or <code>>=</code> a certain time).</li> |
| 63 |
<li>Use this setting by following any of these methods (they all do the same thing), in order of priority: |
| 64 |
<ul> |
| 65 |
<li>jQuery data <code>data-parser="false"</code>.</li> |
| 66 |
<li>metadata <code>class="{ parser: "false" }"</code>. This requires the metadata plugin.</li> |
| 67 |
<li>headers option <code>headers : { 0 : { parser: false } }</code>.</li> |
| 68 |
<li>header class name <code>class="parser-false"</code>.</li> |
| 69 |
</ul> |
| 70 |
</li> |
| 71 |
</ul> |
| 72 |
|
| 73 |
<h1>Demo</h1> |
| 74 |
<div id="demo"><table class="tablesorter"> |
| 75 |
<thead> |
| 76 |
<tr> |
| 77 |
<th>Name</th> |
| 78 |
<th>Age</th> |
| 79 |
|
| 80 |
<th class="sorter-false parser-false">Date</th> |
| 81 |
</tr> |
| 82 |
</thead> |
| 83 |
<tbody> |
| 84 |
<tr><td>Peter Parker</td><td>28</td><td>Jul 6, 2006 8:14 AM</td></tr> |
| 85 |
<tr><td>John Hood</td><td>33</td><td>Dec 10, 2002 5:14 AM</td></tr> |
| 86 |
<tr><td>Clark Kent</td><td>18</td><td>Jan 12, 2003 11:14 AM</td></tr> |
| 87 |
<tr><td>Bruce Almighty</td><td>45</td><td>Jan 18, 2001 9:12 AM</td></tr> |
| 88 |
<tr><td>Bruce Evans</td><td>22</td><td>Jan 18, 2007 9:12 AM</td></tr> |
| 89 |
</tbody> |
| 90 |
</table></div> |
| 91 |
|
| 92 |
<h1>Cached Data</h1> |
| 93 |
<div id="cache"> |
| 94 |
<pre class="prettyprint"></pre> |
| 95 |
</div> |
| 96 |
<h1>Javascript</h1> |
| 97 |
<div id="javascript"> |
| 98 |
<pre class="prettyprint lang-javascript"></pre> |
| 99 |
</div> |
| 100 |
<h1>HTML</h1> |
| 101 |
<div id="html"> |
| 102 |
<pre class="prettyprint lang-html"></pre> |
| 103 |
</div> |
| 104 |
|
| 105 |
</div> |
| 106 |
|
| 107 |
</body> |
| 108 |
</html> |