Debian Codegraph @

docs/example-option-theme-materialize.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Theme Materialize</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 rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.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 <!-- Tablesorter: required for bootstrap -->
18 <link rel="stylesheet" href="../css/theme.materialize.css">
19 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
20 <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
21 <script src="../js/jquery.tablesorter.js"></script>
22 <script src="../js/widgets/widget-filter.js"></script>
23
24 <!-- Tablesorter: optional -->
25 <link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
26 <script src="../addons/pager/jquery.tablesorter.pager.js"></script>
27 <style id="css">/* UL padding override - see https://github.com/Dogfalo/materialize/issues/2786#issuecomment-234809753 */
28 ul { padding-left: 20px; }
29 .btn { font-size: .8em; }
30 /* not sure why this is needed... */
31 .material-icons { vertical-align: bottom; }</style>
32
33 <script id="js">$(function() {
34
35 $("table").tablesorter({
36 theme : "materialize",
37
38 widthFixed: true,
39 // widget code contained in the jquery.tablesorter.widgets.js file
40 // use the zebra stripe widget if you plan on hiding any rows (filter widget)
41 widgets : [ "filter", "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 materialize theming if you are using the filter widget, because rows are hidden
46 zebra : ["even", "odd"],
47
48 // reset filters button
49 filter_reset : ".reset",
50
51 // extra css class name (string or array) added to the filter element (input or select)
52 // select needs a "browser-default" class or it gets hidden
53 filter_cssFilter: ["", "", "browser-default"]
54 }
55 })
56 .tablesorterPager({
57
58 // target the pager markup - see the HTML block below
59 container: $(".ts-pager"),
60
61 // target the pager page select dropdown - choose a page
62 cssGoto : ".pagenum",
63
64 // remove rows from the table to speed up the sort of large tables.
65 // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
66 removeRows: false,
67
68 // output string - default is '{page}/{totalPages}';
69 // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
70 output: '{startRow} - {endRow} / {filteredRows} ({totalRows})'
71
72 });
73
74 });</script>
75
76 <script>
77 $(function() {
78
79 // filter button demo code
80 $('button.filter').click(function() {
81 var col = $(this).data('column'),
82 txt = $(this).data('filter');
83 $('table').find('.tablesorter-filter').val('').eq(col).val(txt);
84 $('table').trigger('search', false);
85 return false;
86 });
87
88 // toggle zebra widget
89 $('button.zebra').click(function() {
90 var t = $(this).hasClass('green');
91 $('table')
92 .toggleClass('striped')[0]
93 .config.widgets = (t) ? ["filter"] : ["filter", "zebra"];
94 $(this)
95 .toggleClass('red green')
96 .find('i')
97 .text(t ? 'clear' : 'done').end()
98 .find('span')
99 .text(t ? 'disabled' : 'enabled');
100 $('table').trigger('refreshWidgets', false);
101 return false;
102 });
103 });
104 </script>
105
106 </head>
107 <body>
108
109 <div id="banner">
110 <h1>table<em>sorter</em></h1>
111 <h2>jQuery Theme - Materialize</h2>
112 <h3>Flexible client-side table sorting</h3>
113 <a href="index.html">Back to documentation</a>
114 </div>
115
116 <div id="main">
117
118 <p class="tip">
119 <span class="label label-info">NOTE!</span>
120 </p>
121 <ul class="browser-default">
122 <li>Added Materialize theme style (<span class="version">v2.27.0</span> for <a href="http://materializecss.com/">materialize</a> v0.97.7).</li>
123 <li>Important Notes:
124 <ul>
125 <li>Any filter select is automatically hidden. It looks like javascript is needed to restyle the select, which this demo isn't using, so I had to include a <code>"browser-default"</code> class in the <code>filter_cssFilter</code> option to prevent it from being hidden.</li>
126 <li>The pager buttons are huge... I didn't see an option for small buttons, just button and large button.</li>
127 <li>Adding a <code>"input-field"</code> class to the filter row (it does wrap the inputs/select LOL), actually seems to break the desired action. The input turns white and the underline disappears. I guess I could just make the entire filter row white... I do miss the "x" inside the search input though.</li>
128 </ul>
129 <br>
130 </li>
131
132 <li>This demo shows how to get around an issue with the filter widget:
133 <ul>
134 <li>The <span class="label label-info">zebra widget button</span> below was added to show that when materialize's "striped" class is applied, the css defined zebra striping will not apply correctly because table rows are hidden but still accounted for by the css <code>nth-child()</code> selector.</li>
135 <li>To better understand this issue, disable the zebra widget (using the toggle button). Now <button type="button" class="filter btn" data-column="5" data-filter=">80"><i class="material-icons">search</i> Filter ">80"</button> in the "Calculus" column.</li>
136 <li>Try other filter searches with the zebra widget disabled, like <button type="button" class="filter btn" data-column="2" data-filter="male"><i class="material-icons">search</i> Filter "male"</button> in the "Sex" column.</li>
137 <li>To solve this issue, just enable the zebra widget and the "even" and "odd" row class names <del>will</del> should over-ride the <code>nth-child()</code> styling.</li>
138 <li>The only down side is that for custom materialize themes, you'll need to edit the "theme.materialize.css" file.</li>
139 </ul>
140 </li>
141 </ul>
142
143 <h4>Demo</h4>
144 <!-- use the filter_reset : '.reset' option or include data-filter="" using the filter button demo code to reset the filters -->
145 <div class="materialize_buttons">
146 Reset filter : <button type="button" class="reset btn" data-column="0" data-filter=""><i class="material-icons">loop</i> Reset filters</button>
147 <p></p>
148 Zebra widget : <button type="button" class="zebra btn green"><i class="material-icons">done</i> <span>enabled</span></button>
149 </div>
150 <br>
151
152 <div id="demo"><table> <!-- add materialize classes, as desired -->
153 <thead>
154 <tr>
155 <th>Name</th>
156 <th>Major</th>
157 <th class="filter-select filter-exact" data-placeholder="Pick a gender">Sex</th>
158 <th>English</th>
159 <th>Japanese</th>
160 <th>Calculus</th>
161 <th>Geometry</th></tr>
162 </thead>
163 <tfoot>
164 <tr>
165 <th>Name</th>
166 <th>Major</th>
167 <th>Sex</th>
168 <th>English</th>
169 <th>Japanese</th>
170 <th>Calculus</th>
171 <th>Geometry</th>
172 </tr>
173 <!-- include "tablesorter-ignoreRow" class for pager rows in thead -->
174 <tr class="tablesorter-ignoreRow">
175 <th colspan="7" class="ts-pager form-horizontal">
176 <button type="button" class="btn first"><i class="small material-icons">first_page</i></button>
177 <button type="button" class="btn prev"><i class="small material-icons">navigate_before</i></button>
178 <span class="pagedisplay"></span>
179 <!-- this can be any element, including an input -->
180 <button type="button" class="btn next"><i class="small material-icons">navigate_next</i></button>
181 <button type="button" class="btn last"><i class="small material-icons">last_page</i></button>
182 <select class="pagesize browser-default" title="Select page size">
183 <option selected="selected" value="10">10</option>
184 <option value="20">20</option>
185 <option value="30">30</option>
186 <option value="40">40</option>
187 </select>
188 <select class="pagenum browser-default" title="Select page number"></select>
189 </th>
190 </tr>
191 </tfoot>
192 <tbody>
193 <tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
194 <tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
195 <tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
196 <tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
197 <tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
198 <tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
199 <tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
200 <tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
201 <tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
202 <tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
203 <tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
204 <tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
205 <tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
206 <tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
207 <tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
208 <tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
209 <tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
210 <tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
211 <tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
212 <tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
213 <tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
214 <tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
215 <tr><td>Student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
216 <tr><td>Student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
217 <tr><td>Student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
218 <tr><td>Student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
219 <tr><td>Student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
220 <tr><td>Student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
221 <tr><td>Student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
222 <tr><td>Student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
223 <tr><td>Student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
224 <tr><td>Student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
225 <tr><td>Student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
226 <tr><td>Student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
227 <tr><td>Student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
228 <tr><td>Student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
229 <tr><td>Student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
230 <tr><td>Student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
231 <tr><td>Student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
232 <tr><td>Student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
233 <tr><td>Student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
234 <tr><td>Student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
235 <tr><td>Student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
236 <tr><td>Student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
237 <tr><td>Student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
238 <tr><td>Student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
239 <tr><td>Student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
240 <tr><td>Student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
241 <tr><td>Student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
242 <tr><td>Student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
243 </tbody>
244 </table></div>
245
246 <h5>Page Header</h5>
247 <div>
248 <pre class="prettyprint lang-html">&lt;!-- materialize stylesheet & icon font --&gt;
249 &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css&quot;&gt;
250 &lt;link rel=&quot;stylesheet&quot; href=&quot;https://fonts.googleapis.com/icon?family=Material+Icons&quot;&gt;
251 &lt;!-- materialize theme --&gt;
252 &lt;link rel=&quot;stylesheet&quot; href=&quot;css/theme.materialize.css&quot;&gt;
253
254 &lt;!-- tablesorter plugin --&gt;
255 &lt;script src=&quot;js/jquery.tablesorter.js&quot;&gt;&lt;/script&gt;
256 &lt;!-- tablesorter widget file - loaded after the plugin --&gt;
257 &lt;script src=&quot;js/jquery.tablesorter.widgets.js&quot;&gt;&lt;/script&gt;
258
259 &lt;!-- pager plugin --&gt;
260 &lt;link rel=&quot;stylesheet&quot; href=&quot;css/jquery.tablesorter.pager.css&quot;&gt;
261 &lt;script src=&quot;js/jquery.tablesorter.pager.js&quot;&gt;&lt;/script&gt;</pre>
262 </div>
263
264 <h5>Javascript</h5>
265 <div id="javascript">
266 <pre class="prettyprint lang-javascript"></pre>
267 </div>
268
269 <h5>CSS</h5>
270 <div id="css">
271 <pre class="prettyprint lang-css"></pre>
272 </div>
273
274 <h5>HTML</h5>
275 <div id="html">
276 <pre class="prettyprint lang-html"></pre>
277 </div>
278
279 </div>
280
281 </body>
282 </html>