| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Bootstrap Theme (Bootstrap v4.x)</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-latest.min.js"></script> |
| 9 |
|
| 10 |
|
| 11 |
<link rel="stylesheet" href="css/jq.css"> |
| 12 |
<link rel="stylesheet" href="css/bootstrap-v4.min.css"> |
| 13 |
<link href="css/prettify.css" rel="stylesheet"> |
| 14 |
<script src="js/prettify.js"></script> |
| 15 |
<script src="js/docs.js"></script> |
| 16 |
|
| 17 |
|
| 18 |
<link rel="stylesheet" href="../css/theme.bootstrap_4.css"> |
| 19 |
<script src="../js/jquery.tablesorter.js"></script> |
| 20 |
<script src="../js/jquery.tablesorter.widgets.js"></script> |
| 21 |
|
| 22 |
|
| 23 |
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css"> |
| 24 |
<style> |
| 25 |
.tablesorter-pager .btn-group-sm .btn { |
| 26 |
font-size: 1.2em; |
| 27 |
} |
| 28 |
</style> |
| 29 |
<script src="../addons/pager/jquery.tablesorter.pager.js"></script> |
| 30 |
|
| 31 |
<script id="js">$(function() { |
| 32 |
|
| 33 |
$("table").tablesorter({ |
| 34 |
theme : "bootstrap", |
| 35 |
|
| 36 |
widthFixed: true, |
| 37 |
|
| 38 |
// widget code contained in the jquery.tablesorter.widgets.js file |
| 39 |
// use the zebra stripe widget if you plan on hiding any rows (filter widget) |
| 40 |
// the uitheme widget is NOT REQUIRED! |
| 41 |
widgets : [ "filter", "columns", "zebra" ], |
| 42 |
|
| 43 |
widgetOptions : { |
| 44 |
// using the default zebra striping class name, so it actually isn't included in the theme variable above |
| 45 |
// this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden |
| 46 |
zebra : ["even", "odd"], |
| 47 |
|
| 48 |
// class names added to columns when sorted |
| 49 |
columns: [ "primary", "secondary", "tertiary" ], |
| 50 |
|
| 51 |
// reset filters button |
| 52 |
filter_reset : ".reset", |
| 53 |
|
| 54 |
// extra css class name (string or array) added to the filter element (input or select) |
| 55 |
filter_cssFilter: [ |
| 56 |
'form-control', |
| 57 |
'form-control', |
| 58 |
'form-control custom-select', // select needs custom class names :( |
| 59 |
'form-control', |
| 60 |
'form-control', |
| 61 |
'form-control', |
| 62 |
'form-control' |
| 63 |
] |
| 64 |
|
| 65 |
} |
| 66 |
}) |
| 67 |
.tablesorterPager({ |
| 68 |
|
| 69 |
// target the pager markup - see the HTML block below |
| 70 |
container: $(".ts-pager"), |
| 71 |
|
| 72 |
// target the pager page select dropdown - choose a page |
| 73 |
cssGoto : ".pagenum", |
| 74 |
|
| 75 |
// remove rows from the table to speed up the sort of large tables. |
| 76 |
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. |
| 77 |
removeRows: false, |
| 78 |
|
| 79 |
// output string - default is '{page}/{totalPages}'; |
| 80 |
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} |
| 81 |
output: '{startRow} - {endRow} / {filteredRows} ({totalRows})' |
| 82 |
|
| 83 |
}); |
| 84 |
|
| 85 |
});</script> |
| 86 |
|
| 87 |
<script> |
| 88 |
$(function() { |
| 89 |
|
| 90 |
// filter button demo code |
| 91 |
$('button.filter').click(function() { |
| 92 |
var col = $(this).data('column'), |
| 93 |
txt = $(this).data('filter'); |
| 94 |
$('table').find('.tablesorter-filter').val('').eq(col).val(txt); |
| 95 |
$('table').trigger('search', false); |
| 96 |
return false; |
| 97 |
}); |
| 98 |
|
| 99 |
// toggle zebra widget |
| 100 |
$('button.zebra').click(function() { |
| 101 |
var t = $(this).hasClass('btn-success'); |
| 102 |
$('table') |
| 103 |
.toggleClass('table-striped')[0] |
| 104 |
.config.widgets = (t) ? ["filter"] : ["filter", "zebra"]; |
| 105 |
$(this) |
| 106 |
.toggleClass('btn-danger btn-success') |
| 107 |
.find('span') |
| 108 |
.text(t ? 'disabled' : 'enabled'); |
| 109 |
$('table').trigger('refreshWidgets', [false]); |
| 110 |
return false; |
| 111 |
}); |
| 112 |
}); |
| 113 |
</script> |
| 114 |
|
| 115 |
</head> |
| 116 |
<body> |
| 117 |
|
| 118 |
<div id="banner"> |
| 119 |
<h1>table<em>sorter</em></h1> |
| 120 |
<h2>jQuery Theme (Bootstrap v4.x)</h2> |
| 121 |
<h3>Flexible client-side table sorting</h3> |
| 122 |
<a href="index.html">Back to documentation</a> |
| 123 |
</div> |
| 124 |
|
| 125 |
<div id="main"> |
| 126 |
|
| 127 |
<ul> |
| 128 |
<li>Go to <a href="example-option-theme-bootstrap-v3.html">Bootstrap v3.x</a> or <a href="example-option-theme-bootstrap-v2.html">Bootstrap v2.x</a> demo.</li> |
| 129 |
<li>Get the current version of <a href="https://getbootstrap.com/">Bootstrap</a> (now v4.x).<br><br></li> |
| 130 |
|
| 131 |
<li>In <span class="version updated">v2.31.3</span>, updated to Bootstrap 4.4.1.</li> |
| 132 |
<li>In <span class="version updated">v2.29.3</span> |
| 133 |
<ul> |
| 134 |
<li>Updated to use Bootstrap v4.0.0-beta.2.</li> |
| 135 |
<li>Updated theme v4 by changing <code>table-inverse</code> to <code>table-dark</code>.</li> |
| 136 |
<li>Updated theme v4 by changing <code>thead-inverse</code> to <code>thead-dark</code>.</li> |
| 137 |
</ul> |
| 138 |
</li> |
| 139 |
<li>In <span class="version updated">v2.29.0</span>, updated to use Bootstrap v4.0.0-beta.</li> |
| 140 |
<li>In <span class="version">v2.28.4</span>, added this Bootstrap v4.0.0-alpha.6 demo.</li> |
| 141 |
<li>Notes: |
| 142 |
<ul> |
| 143 |
<li>This version of the theme <strong>no longer requires the UITheme widget</strong>!</li> |
| 144 |
<li>Bootstrap v4.x no longer includes fonts or images, so I didn't bother including Font Awesome icons on this demo page.</li> |
| 145 |
<li>For more information like revision history of this theme & why there is a button to enable/disable the zebra widget, please see the <a href="example-option-theme-bootstrap-v3.html">Bootstrap v3.x demo</a>.</li> |
| 146 |
</ul> |
| 147 |
</li> |
| 148 |
</ul> |
| 149 |
|
| 150 |
<h1>Demo</h1> |
| 151 |
|
| 152 |
<div class="bootstrap_buttons"> |
| 153 |
Reset filter : <button type="button" class="reset btn btn-primary" data-column="0" data-filter="">Reset filters</button> |
| 154 |
<br> |
| 155 |
Zebra widget : <button type="button" class="zebra btn btn-success"><span>enabled</span></button> |
| 156 |
</div> |
| 157 |
<br> |
| 158 |
|
| 159 |
<div id="demo"><table class="table table-bordered table-striped"> |
| 160 |
<thead class="thead-dark"> |
| 161 |
<tr> |
| 162 |
<th>Name</th> |
| 163 |
<th>Major</th> |
| 164 |
<th class="filter-select filter-exact" data-placeholder="Pick a gender">Sex</th> |
| 165 |
<th>English</th> |
| 166 |
<th>Japanese</th> |
| 167 |
<th>Calculus</th> |
| 168 |
<th class="sorter-false filter-false">Geometry</th></tr> |
| 169 |
</thead> |
| 170 |
<tfoot> |
| 171 |
<tr> |
| 172 |
<th>Name</th> |
| 173 |
<th>Major</th> |
| 174 |
<th>Sex</th> |
| 175 |
<th>English</th> |
| 176 |
<th>Japanese</th> |
| 177 |
<th>Calculus</th> |
| 178 |
<th>Geometry</th> |
| 179 |
</tr> |
| 180 |
<tr> |
| 181 |
<th colspan="7" class="ts-pager"> |
| 182 |
<div class="form-inline"> |
| 183 |
<div class="btn-group btn-group-sm mx-1" role="group"> |
| 184 |
<button type="button" class="btn btn-secondary first" title="first">⇤</button> |
| 185 |
<button type="button" class="btn btn-secondary prev" title="previous">←</button> |
| 186 |
</div> |
| 187 |
<span class="pagedisplay"></span> |
| 188 |
<div class="btn-group btn-group-sm mx-1" role="group"> |
| 189 |
<button type="button" class="btn btn-secondary next" title="next">→</button> |
| 190 |
<button type="button" class="btn btn-secondary last" title="last">⇥</button> |
| 191 |
</div> |
| 192 |
<select class="form-control-sm custom-select px-1 pagesize" title="Select page size"> |
| 193 |
<option selected="selected" value="10">10</option> |
| 194 |
<option value="20">20</option> |
| 195 |
<option value="30">30</option> |
| 196 |
<option value="all">All Rows</option> |
| 197 |
</select> |
| 198 |
<select class="form-control-sm custom-select px-4 mx-1 pagenum" title="Select page number"></select> |
| 199 |
</div> |
| 200 |
</th> |
| 201 |
</tr> |
| 202 |
</tfoot> |
| 203 |
<tbody> |
| 204 |
<tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr> |
| 205 |
<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr> |
| 206 |
<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr> |
| 207 |
<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr> |
| 208 |
<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr> |
| 209 |
<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr> |
| 210 |
<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr> |
| 211 |
<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr> |
| 212 |
<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr> |
| 213 |
<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr> |
| 214 |
<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr> |
| 215 |
<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr> |
| 216 |
<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr> |
| 217 |
<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr> |
| 218 |
<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr> |
| 219 |
<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr> |
| 220 |
<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr> |
| 221 |
<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr> |
| 222 |
<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr> |
| 223 |
<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr> |
| 224 |
<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr> |
| 225 |
<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr> |
| 226 |
<tr><td>Student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr> |
| 227 |
<tr><td>Student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr> |
| 228 |
<tr><td>Student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr> |
| 229 |
<tr><td>Student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr> |
| 230 |
<tr><td>Student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr> |
| 231 |
<tr><td>Student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr> |
| 232 |
<tr><td>Student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr> |
| 233 |
<tr><td>Student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr> |
| 234 |
<tr><td>Student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr> |
| 235 |
<tr><td>Student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr> |
| 236 |
<tr><td>Student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr> |
| 237 |
<tr><td>Student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr> |
| 238 |
<tr><td>Student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr> |
| 239 |
<tr><td>Student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr> |
| 240 |
<tr><td>Student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr> |
| 241 |
<tr><td>Student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr> |
| 242 |
<tr><td>Student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr> |
| 243 |
<tr><td>Student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr> |
| 244 |
<tr><td>Student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr> |
| 245 |
<tr><td>Student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr> |
| 246 |
<tr><td>Student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr> |
| 247 |
<tr><td>Student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr> |
| 248 |
<tr><td>Student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr> |
| 249 |
<tr><td>Student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr> |
| 250 |
<tr><td>Student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr> |
| 251 |
<tr><td>Student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr> |
| 252 |
<tr><td>Student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr> |
| 253 |
<tr><td>Student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr> |
| 254 |
</tbody> |
| 255 |
</table></div> |
| 256 |
|
| 257 |
<h2>Page Header</h2> |
| 258 |
<div> |
| 259 |
<pre class="prettyprint lang-html"><!-- Bootstrap v4.x stylesheet --> |
| 260 |
<link rel="stylesheet" href="css/bootstrap.min.css"> |
| 261 |
<!-- bootstrap css theme --> |
| 262 |
<link rel="stylesheet" href="css/theme.bootstrap_4.css"> |
| 263 |
|
| 264 |
<script src="js/jquery.min.js"></script> |
| 265 |
<script src="js/jquery.tablesorter.js"></script> |
| 266 |
<script src="js/jquery.tablesorter.widgets.js"></script> |
| 267 |
|
| 268 |
<!-- pager plugin --> |
| 269 |
<link rel="stylesheet" href="css/jquery.tablesorter.pager.css"> |
| 270 |
<script src="js/jquery.tablesorter.pager.js"></script> |
| 271 |
<style> |
| 272 |
.tablesorter-pager .btn-group-sm .btn { |
| 273 |
font-size: 1.2em; /* make pager arrows more visible */ |
| 274 |
} |
| 275 |
</style></pre> |
| 276 |
</div> |
| 277 |
|
| 278 |
<h2>Javascript</h2> |
| 279 |
<div id="javascript"> |
| 280 |
<pre class="prettyprint lang-javascript"></pre> |
| 281 |
</div> |
| 282 |
|
| 283 |
<h2>HTML</h2> |
| 284 |
<div id="html"> |
| 285 |
<pre class="prettyprint lang-html"></pre> |
| 286 |
</div> |
| 287 |
|
| 288 |
<div class="next-up"> |
| 289 |
<hr /> |
| 290 |
Next up: <a href="example-widget-bootstrap-theme-v3.html">Bootstrap v3.x demo ››</a> |
| 291 |
</div> |
| 292 |
|
| 293 |
</div> |
| 294 |
|
| 295 |
</body> |
| 296 |
</html> |