| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Sorting Accented Characters</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 id="js">$(function() { |
| 21 |
|
| 22 |
// these default equivalents were obtained from a table of equivalents |
| 23 |
// provided by sugar.js sorting alogrithms: |
| 24 |
// https://sugarjs.com/docs/#/ArraySorting |
| 25 |
/* |
| 26 |
$.tablesorter.characterEquivalents = { |
| 27 |
'a' : '\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5', // áàâãäąå |
| 28 |
'A' : '\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5', // ÁÀÂÃÄĄÅ |
| 29 |
'c' : '\u00e7\u0107\u010d', // çćč |
| 30 |
'C' : '\u00c7\u0106\u010c', // ÇĆČ |
| 31 |
'e' : '\u00e9\u00e8\u00ea\u00eb\u011b\u0119', // éèêëěę |
| 32 |
'E' : '\u00c9\u00c8\u00ca\u00cb\u011a\u0118', // ÉÈÊËĚĘ |
| 33 |
'i' : '\u00ed\u00ec\u0130\u00ee\u00ef\u0131', // íìİîïı |
| 34 |
'I' : '\u00cd\u00cc\u0130\u00ce\u00cf', // ÍÌİÎÏ |
| 35 |
'o' : '\u00f3\u00f2\u00f4\u00f5\u00f6\u014d', // óòôõöō |
| 36 |
'O' : '\u00d3\u00d2\u00d4\u00d5\u00d6\u014c', // ÓÒÔÕÖŌ |
| 37 |
'ss': '\u00df', // ß (s sharp) |
| 38 |
'SS': '\u1e9e', // ẞ (Capital sharp s) |
| 39 |
'u' : '\u00fa\u00f9\u00fb\u00fc\u016f', // úùûüů |
| 40 |
'U' : '\u00da\u00d9\u00db\u00dc\u016e' // ÚÙÛÜŮ |
| 41 |
}; |
| 42 |
*/ |
| 43 |
// modify the above defaults as follows |
| 44 |
$.extend( $.tablesorter.characterEquivalents, { |
| 45 |
"ae" : "\u00e6", // expanding characters æ Æ |
| 46 |
"AE" : "\u00c6", |
| 47 |
"oe" : "\u00f6\u0153", // œ Œ |
| 48 |
"OE" : "\u00d6\u0152", |
| 49 |
"d" : "\u00f0", // Eth (ð Ð) |
| 50 |
"D" : "\u00d0", |
| 51 |
"o" : "\u00f3\u00f2\u00f4\u00f5", // remove ö because it's in the oe now |
| 52 |
"O" : "\u00d3\u00d2\u00d4\u00d5" // remove Ö because it's in the OE now |
| 53 |
}); |
| 54 |
|
| 55 |
$("table").tablesorter({ |
| 56 |
theme : 'blue', |
| 57 |
// Enable use of the characterEquivalents reference |
| 58 |
sortLocaleCompare : true, |
| 59 |
// maintain a stable sort (First Name column) |
| 60 |
sortStable : true, |
| 61 |
// if false, upper case sorts BEFORE lower case |
| 62 |
ignoreCase : true |
| 63 |
}); |
| 64 |
});</script> |
| 65 |
</head> |
| 66 |
<body> |
| 67 |
<div id="banner"> |
| 68 |
<h1>table<em>sorter</em></h1> |
| 69 |
<h2>Sorting Accented Characters</h2> |
| 70 |
<h3>Flexible client-side table sorting</h3> |
| 71 |
<a href="index.html">Back to documentation</a> |
| 72 |
</div> |
| 73 |
<div id="main"> |
| 74 |
|
| 75 |
<p class="tip"> |
| 76 |
<em>NOTE!</em> |
| 77 |
</p> |
| 78 |
<ul> |
| 79 |
<li>Accented characters will get replaced by their character equivalent when the <code>sortLocaleCompare</code> option is <code>true</code>.</li> |
| 80 |
<li>In the javascript code block below you can see the default <code>$.tablesorter.characterEquivalents</code> table and an example of how to extend it to include other equivalents.</li> |
| 81 |
<li>If you have a specific language requirement, please refer to the <a href="https://github.com/Mottie/tablesorter/wiki/Language">Language</a> wiki pages to see if it is there. If not, please consider sharing the code or even just share the character equivalents themselves.</li> |
| 82 |
</ul> |
| 83 |
|
| 84 |
<h1>Demo</h1> |
| 85 |
<div id="demo"><table class="tablesorter"> |
| 86 |
<thead> |
| 87 |
<tr> |
| 88 |
<th>Account #</th> |
| 89 |
<th>First Name</th> |
| 90 |
<th>Last Name</th> |
| 91 |
<th>Age</th> |
| 92 |
<th>Location</th> |
| 93 |
</tr> |
| 94 |
</thead> |
| 95 |
<tbody> |
| 96 |
<tr> |
| 97 |
<td>a1a10</td> |
| 98 |
<td>AnderE</td> |
| 99 |
<td>Parker</td> |
| 100 |
<td>28</td> |
| 101 |
<td>Béchar</td> |
| 102 |
</tr> |
| 103 |
<tr> |
| 104 |
<td>a1a2</td> |
| 105 |
<td>Ändere</td> |
| 106 |
<td>Hood</td> |
| 107 |
<td>33</td> |
| 108 |
<td>Bebington</td> |
| 109 |
</tr> |
| 110 |
<tr> |
| 111 |
<td>A1a1</td> |
| 112 |
<td>Andére</td> |
| 113 |
<td>Kent</td> |
| 114 |
<td>18</td> |
| 115 |
<td>Berlin</td> |
| 116 |
</tr> |
| 117 |
<tr> |
| 118 |
<td>A2b2</td> |
| 119 |
<td>CotÉ</td> |
| 120 |
<td>Almighty</td> |
| 121 |
<td>45</td> |
| 122 |
<td>Beckum</td> |
| 123 |
</tr> |
| 124 |
<tr> |
| 125 |
<td>A1d2</td> |
| 126 |
<td>CÔte</td> |
| 127 |
<td>Evans</td> |
| 128 |
<td>56</td> |
| 129 |
<td>Curaçao</td> |
| 130 |
</tr> |
| 131 |
<tr> |
| 132 |
<td>a2b11</td> |
| 133 |
<td>CÔtÉ</td> |
| 134 |
<td>Clark</td> |
| 135 |
<td>44</td> |
| 136 |
<td>Béjaïa</td> |
| 137 |
</tr> |
| 138 |
<tr> |
| 139 |
<td>A2b1</td> |
| 140 |
<td>Çote</td> |
| 141 |
<td>Presley</td> |
| 142 |
<td>24</td> |
| 143 |
<td>Bekkevoort</td> |
| 144 |
</tr> |
| 145 |
<tr> |
| 146 |
<td>A1b0</td> |
| 147 |
<td>Andéré</td> |
| 148 |
<td>Carter</td> |
| 149 |
<td>40</td> |
| 150 |
<td>Bègles</td> |
| 151 |
</tr> |
| 152 |
</tbody> |
| 153 |
</table></div> |
| 154 |
|
| 155 |
<h1>Javascript</h1> |
| 156 |
<div id="javascript"> |
| 157 |
<pre class="prettyprint lang-javascript"></pre> |
| 158 |
</div> |
| 159 |
<h1>HTML</h1> |
| 160 |
<div id="html"> |
| 161 |
<pre class="prettyprint lang-html"></pre> |
| 162 |
</div> |
| 163 |
|
| 164 |
<div class="next-up"> |
| 165 |
<hr /> |
| 166 |
Next up: <a href="example-multiple-tbodies.html">Sorting with Multiple Tbodies ››</a> |
| 167 |
</div> |
| 168 |
|
| 169 |
</div> |
| 170 |
|
| 171 |
</body> |
| 172 |
</html> |