0
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
2 <html>
|
|
3 <head>
|
|
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
5 <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico">
|
|
6
|
|
7 <title>ColVis example</title>
|
|
8 <style type="text/css" title="currentStyle">
|
|
9 @import "../../media/css/demo_page.css";
|
|
10 @import "../../media/css/demo_table_jui.css";
|
|
11 @import "../../examples/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css";
|
|
12 @import "media/css/ColVisAlt.css";
|
|
13 </style>
|
|
14 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script>
|
|
15 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script>
|
|
16 <script type="text/javascript" charset="utf-8" src="media/js/ColVis.js"></script>
|
|
17 <script type="text/javascript" charset="utf-8">
|
|
18 $(document).ready( function () {
|
|
19 $('#example').dataTable( {
|
|
20 "sDom": '<"H"fr>tC<"F"ip>',
|
|
21 "bJQueryUI": true,
|
|
22 "bPaginate": false,
|
|
23 "sScrollY": "200px",
|
|
24 "bScrollCollapse": true,
|
|
25 "bScrollAutoCss": false,
|
|
26 "aoColumnDefs": [
|
|
27 { "bVisible": false, "aTargets": [ 2 ] }
|
|
28 ],
|
|
29 "oColVis": {
|
|
30 "buttonText": " ",
|
|
31 "bRestore": true,
|
|
32 "sAlign": "right"
|
|
33 },
|
|
34 "fnDrawCallback": function (o) {
|
|
35 /* Position the ColVis button as needed */
|
|
36 var nColVis = $('div.ColVis', o.nTableWrapper)[0];
|
|
37 nColVis.style.width = o.oScroll.iBarWidth+"px";
|
|
38 nColVis.style.top = ($('div.dataTables_scroll', o.nTableWrapper).position().top)+"px";
|
|
39 nColVis.style.height = ($('div.dataTables_scrollHead table', o.nTableWrapper).height())+"px";
|
|
40 }
|
|
41 } );
|
|
42 } );
|
|
43 </script>
|
|
44 </head>
|
|
45 <body id="dt_example">
|
|
46 <div id="container">
|
|
47 <div class="full_width big">
|
|
48 ColVis example with alternative styling
|
|
49 </div>
|
|
50
|
|
51 <h1>Preamble</h1>
|
|
52 <p>This demo of ColVis shows a number of different features of the plug-in. Firstly, it shows alternative styling of the plug-in with the button nested just above the scrollbar in the DataTable. Secondly there is a "Restore" button in the ColVis drop down, which will restore the original visibility settings when the table was initialised (this is controlled by using the "bRestore" option). Finally it shows that the drop down can be set to align on the right of the button, rather than the left.</p>
|
|
53 <p>Note that this demo requires DataTables 1.7.5 or later.</p>
|
|
54
|
|
55 <h1>Live example</h1>
|
|
56 <form>
|
|
57 <div id="demo">
|
|
58 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
|
59 <thead>
|
|
60 <tr>
|
|
61 <th>Rendering engine</th>
|
|
62 <th>Browser</th>
|
|
63 <th>Platform(s)</th>
|
|
64 <th>Engine version</th>
|
|
65 <th>CSS grade</th>
|
|
66 </tr>
|
|
67 </thead>
|
|
68 <tfoot>
|
|
69 <tr>
|
|
70 <th>Rendering engine</th>
|
|
71 <th>Browser</th>
|
|
72 <th>Platform(s)</th>
|
|
73 <th>Engine version</th>
|
|
74 <th>CSS grade</th>
|
|
75 </tr>
|
|
76 </tfoot>
|
|
77 <tbody>
|
|
78 <tr class="odd_gradeX">
|
|
79 <td>Trident</td>
|
|
80 <td>Internet Explorer 4.0</td>
|
|
81 <td>Win 95+ (Entity: &)</td>
|
|
82 <td class="center">4</td>
|
|
83 <td class="center">X</td>
|
|
84 </tr>
|
|
85 <tr class="even_gradeC">
|
|
86 <td>Trident</td>
|
|
87 <td>Internet Explorer 5.0</td>
|
|
88 <td>Win 95+</td>
|
|
89 <td class="center">5</td>
|
|
90 <td class="center">C</td>
|
|
91 </tr>
|
|
92 <tr class="odd_gradeA">
|
|
93 <td>Trident</td>
|
|
94 <td>Internet Explorer 5.5</td>
|
|
95 <td>Win 95+</td>
|
|
96 <td class="center">5.5</td>
|
|
97 <td class="center">A</td>
|
|
98 </tr>
|
|
99 <tr class="even_gradeA">
|
|
100 <td>Trident</td>
|
|
101 <td>Internet Explorer 6</td>
|
|
102 <td>Win 98+</td>
|
|
103 <td class="center">6</td>
|
|
104 <td class="center">A</td>
|
|
105 </tr>
|
|
106 <tr class="odd_gradeA">
|
|
107 <td>Trident</td>
|
|
108 <td>Internet Explorer 7</td>
|
|
109 <td>Win XP SP2+</td>
|
|
110 <td class="center">7</td>
|
|
111 <td class="center">A</td>
|
|
112 </tr>
|
|
113 <tr class="even_gradeA">
|
|
114 <td>Trident</td>
|
|
115 <td>AOL browser (AOL desktop)</td>
|
|
116 <td>Win XP</td>
|
|
117 <td class="center">6</td>
|
|
118 <td class="center">A</td>
|
|
119 </tr>
|
|
120 <tr class="odd_gradeA">
|
|
121 <td>Gecko (UTF-8: $¢€)</td>
|
|
122 <td>Firefox 1.0</td>
|
|
123 <td>Win 98+ / OSX.2+</td>
|
|
124 <td class="center">1.7</td>
|
|
125 <td class="center">A</td>
|
|
126 </tr>
|
|
127 <tr class="even_gradeA">
|
|
128 <td>Gecko</td>
|
|
129 <td>Firefox 1.5</td>
|
|
130 <td>Win 98+ / OSX.2+</td>
|
|
131 <td class="center">1.8</td>
|
|
132 <td class="center">A</td>
|
|
133 </tr>
|
|
134 <tr class="odd_gradeA">
|
|
135 <td>Gecko</td>
|
|
136 <td>Firefox 2.0</td>
|
|
137 <td>Win 98+ / OSX.2+</td>
|
|
138 <td class="center">1.8</td>
|
|
139 <td class="center">A</td>
|
|
140 </tr>
|
|
141 <tr class="even_gradeA">
|
|
142 <td>Gecko</td>
|
|
143 <td>Firefox 3.0</td>
|
|
144 <td>Win 2k+ / OSX.3+</td>
|
|
145 <td class="center">1.9</td>
|
|
146 <td class="center">A</td>
|
|
147 </tr>
|
|
148 <tr class="odd_gradeA">
|
|
149 <td>Gecko</td>
|
|
150 <td>Camino 1.0</td>
|
|
151 <td>OSX.2+</td>
|
|
152 <td class="center">1.8</td>
|
|
153 <td class="center">A</td>
|
|
154 </tr>
|
|
155 <tr class="even_gradeA">
|
|
156 <td>Gecko</td>
|
|
157 <td>Camino 1.5</td>
|
|
158 <td>OSX.3+</td>
|
|
159 <td class="center">1.8</td>
|
|
160 <td class="center">A</td>
|
|
161 </tr>
|
|
162 <tr class="odd_gradeA">
|
|
163 <td>Gecko</td>
|
|
164 <td>Netscape 7.2</td>
|
|
165 <td>Win 95+ / Mac OS 8.6-9.2</td>
|
|
166 <td class="center">1.7</td>
|
|
167 <td class="center">A</td>
|
|
168 </tr>
|
|
169 <tr class="even_gradeA">
|
|
170 <td>Gecko</td>
|
|
171 <td>Netscape Browser 8</td>
|
|
172 <td>Win 98SE+</td>
|
|
173 <td class="center">1.7</td>
|
|
174 <td class="center">A</td>
|
|
175 </tr>
|
|
176 <tr class="odd_gradeA">
|
|
177 <td>Gecko</td>
|
|
178 <td>Netscape Navigator 9</td>
|
|
179 <td>Win 98+ / OSX.2+</td>
|
|
180 <td class="center">1.8</td>
|
|
181 <td class="center">A</td>
|
|
182 </tr>
|
|
183 <tr class="even_gradeA">
|
|
184 <td>Gecko</td>
|
|
185 <td>Mozilla 1.0</td>
|
|
186 <td>Win 95+ / OSX.1+</td>
|
|
187 <td class="center">1</td>
|
|
188 <td class="center">A</td>
|
|
189 </tr>
|
|
190 <tr class="odd_gradeA">
|
|
191 <td>Gecko</td>
|
|
192 <td>Mozilla 1.1</td>
|
|
193 <td>Win 95+ / OSX.1+</td>
|
|
194 <td class="center">1.1</td>
|
|
195 <td class="center">A</td>
|
|
196 </tr>
|
|
197 <tr class="even_gradeA">
|
|
198 <td>Gecko</td>
|
|
199 <td>Mozilla 1.2</td>
|
|
200 <td>Win 95+ / OSX.1+</td>
|
|
201 <td class="center">1.2</td>
|
|
202 <td class="center">A</td>
|
|
203 </tr>
|
|
204 <tr class="odd_gradeA">
|
|
205 <td>Gecko</td>
|
|
206 <td>Mozilla 1.3</td>
|
|
207 <td>Win 95+ / OSX.1+</td>
|
|
208 <td class="center">1.3</td>
|
|
209 <td class="center">A</td>
|
|
210 </tr>
|
|
211 <tr class="even_gradeA">
|
|
212 <td>Gecko</td>
|
|
213 <td>Mozilla 1.4</td>
|
|
214 <td>Win 95+ / OSX.1+</td>
|
|
215 <td class="center">1.4</td>
|
|
216 <td class="center">A</td>
|
|
217 </tr>
|
|
218 <tr class="odd_gradeA">
|
|
219 <td>Gecko</td>
|
|
220 <td>Mozilla 1.5</td>
|
|
221 <td>Win 95+ / OSX.1+</td>
|
|
222 <td class="center">1.5</td>
|
|
223 <td class="center">A</td>
|
|
224 </tr>
|
|
225 <tr class="even_gradeA">
|
|
226 <td>Gecko</td>
|
|
227 <td>Mozilla 1.6</td>
|
|
228 <td>Win 95+ / OSX.1+</td>
|
|
229 <td class="center">1.6</td>
|
|
230 <td class="center">A</td>
|
|
231 </tr>
|
|
232 <tr class="odd_gradeA">
|
|
233 <td>Gecko</td>
|
|
234 <td>Mozilla 1.7</td>
|
|
235 <td>Win 98+ / OSX.1+</td>
|
|
236 <td class="center">1.7</td>
|
|
237 <td class="center">A</td>
|
|
238 </tr>
|
|
239 <tr class="even_gradeA">
|
|
240 <td>Gecko</td>
|
|
241 <td>Mozilla 1.8</td>
|
|
242 <td>Win 98+ / OSX.1+</td>
|
|
243 <td class="center">1.8</td>
|
|
244 <td class="center">A</td>
|
|
245 </tr>
|
|
246 <tr class="odd_gradeA">
|
|
247 <td>Gecko</td>
|
|
248 <td>Seamonkey 1.1</td>
|
|
249 <td>Win 98+ / OSX.2+</td>
|
|
250 <td class="center">1.8</td>
|
|
251 <td class="center">A</td>
|
|
252 </tr>
|
|
253 <tr class="even_gradeA">
|
|
254 <td>Gecko</td>
|
|
255 <td>Epiphany 2.20</td>
|
|
256 <td>Gnome</td>
|
|
257 <td class="center">1.8</td>
|
|
258 <td class="center">A</td>
|
|
259 </tr>
|
|
260 <tr class="odd_gradeA">
|
|
261 <td>Webkit</td>
|
|
262 <td>Safari 1.2</td>
|
|
263 <td>OSX.3</td>
|
|
264 <td class="center">125.5</td>
|
|
265 <td class="center">A</td>
|
|
266 </tr>
|
|
267 <tr class="even_gradeA">
|
|
268 <td>Webkit</td>
|
|
269 <td>Safari 1.3</td>
|
|
270 <td>OSX.3</td>
|
|
271 <td class="center">312.8</td>
|
|
272 <td class="center">A</td>
|
|
273 </tr>
|
|
274 <tr class="odd_gradeA">
|
|
275 <td>Webkit</td>
|
|
276 <td>Safari 2.0</td>
|
|
277 <td>OSX.4+</td>
|
|
278 <td class="center">419.3</td>
|
|
279 <td class="center">A</td>
|
|
280 </tr>
|
|
281 <tr class="even_gradeA">
|
|
282 <td>Webkit</td>
|
|
283 <td>Safari 3.0</td>
|
|
284 <td>OSX.4+</td>
|
|
285 <td class="center">522.1</td>
|
|
286 <td class="center">A</td>
|
|
287 </tr>
|
|
288 <tr class="odd_gradeA">
|
|
289 <td>Webkit</td>
|
|
290 <td>OmniWeb 5.5</td>
|
|
291 <td>OSX.4+</td>
|
|
292 <td class="center">420</td>
|
|
293 <td class="center">A</td>
|
|
294 </tr>
|
|
295 <tr class="even_gradeA">
|
|
296 <td>Webkit</td>
|
|
297 <td>iPod Touch / iPhone</td>
|
|
298 <td>iPod</td>
|
|
299 <td class="center">420.1</td>
|
|
300 <td class="center">A</td>
|
|
301 </tr>
|
|
302 <tr class="odd_gradeA">
|
|
303 <td>Webkit</td>
|
|
304 <td>S60</td>
|
|
305 <td>S60</td>
|
|
306 <td class="center">413</td>
|
|
307 <td class="center">A</td>
|
|
308 </tr>
|
|
309 <tr class="even_gradeA">
|
|
310 <td>Presto</td>
|
|
311 <td>Opera 7.0</td>
|
|
312 <td>Win 95+ / OSX.1+</td>
|
|
313 <td class="center">-</td>
|
|
314 <td class="center">A</td>
|
|
315 </tr>
|
|
316 <tr class="odd_gradeA">
|
|
317 <td>Presto</td>
|
|
318 <td>Opera 7.5</td>
|
|
319 <td>Win 95+ / OSX.2+</td>
|
|
320 <td class="center">-</td>
|
|
321 <td class="center">A</td>
|
|
322 </tr>
|
|
323 <tr class="even_gradeA">
|
|
324 <td>Presto</td>
|
|
325 <td>Opera 8.0</td>
|
|
326 <td>Win 95+ / OSX.2+</td>
|
|
327 <td class="center">-</td>
|
|
328 <td class="center">A</td>
|
|
329 </tr>
|
|
330 <tr class="odd_gradeA">
|
|
331 <td>Presto</td>
|
|
332 <td>Opera 8.5</td>
|
|
333 <td>Win 95+ / OSX.2+</td>
|
|
334 <td class="center">-</td>
|
|
335 <td class="center">A</td>
|
|
336 </tr>
|
|
337 <tr class="even_gradeA">
|
|
338 <td>Presto</td>
|
|
339 <td>Opera 9.0</td>
|
|
340 <td>Win 95+ / OSX.3+</td>
|
|
341 <td class="center">-</td>
|
|
342 <td class="center">A</td>
|
|
343 </tr>
|
|
344 <tr class="odd_gradeA">
|
|
345 <td>Presto</td>
|
|
346 <td>Opera 9.2</td>
|
|
347 <td>Win 88+ / OSX.3+</td>
|
|
348 <td class="center">-</td>
|
|
349 <td class="center">A</td>
|
|
350 </tr>
|
|
351 <tr class="even_gradeA">
|
|
352 <td>Presto</td>
|
|
353 <td>Opera 9.5</td>
|
|
354 <td>Win 88+ / OSX.3+</td>
|
|
355 <td class="center">-</td>
|
|
356 <td class="center">A</td>
|
|
357 </tr>
|
|
358 <tr class="odd_gradeA">
|
|
359 <td>Presto</td>
|
|
360 <td>Opera for Wii</td>
|
|
361 <td>Wii</td>
|
|
362 <td class="center">-</td>
|
|
363 <td class="center">A</td>
|
|
364 </tr>
|
|
365 <tr class="even_gradeA">
|
|
366 <td>Presto</td>
|
|
367 <td>Nokia N800</td>
|
|
368 <td>N800</td>
|
|
369 <td class="center">-</td>
|
|
370 <td class="center">A</td>
|
|
371 </tr>
|
|
372 <tr class="odd_gradeA">
|
|
373 <td>Presto</td>
|
|
374 <td>Nintendo DS browser</td>
|
|
375 <td>Nintendo DS</td>
|
|
376 <td class="center">8.5</td>
|
|
377 <td class="center">C/A<sup>1</sup></td>
|
|
378 </tr>
|
|
379 <tr class="even_gradeC">
|
|
380 <td>KHTML</td>
|
|
381 <td>Konqureror 3.1</td>
|
|
382 <td>KDE 3.1</td>
|
|
383 <td class="center">3.1</td>
|
|
384 <td class="center">C</td>
|
|
385 </tr>
|
|
386 <tr class="odd_gradeA">
|
|
387 <td>KHTML</td>
|
|
388 <td>Konqureror 3.3</td>
|
|
389 <td>KDE 3.3</td>
|
|
390 <td class="center">3.3</td>
|
|
391 <td class="center">A</td>
|
|
392 </tr>
|
|
393 <tr class="even_gradeA">
|
|
394 <td>KHTML</td>
|
|
395 <td>Konqureror 3.5</td>
|
|
396 <td>KDE 3.5</td>
|
|
397 <td class="center">3.5</td>
|
|
398 <td class="center">A</td>
|
|
399 </tr>
|
|
400 <tr class="odd_gradeX">
|
|
401 <td>Tasman</td>
|
|
402 <td>Internet Explorer 4.5</td>
|
|
403 <td>Mac OS 8-9</td>
|
|
404 <td class="center">-</td>
|
|
405 <td class="center">X</td>
|
|
406 </tr>
|
|
407 <tr class="even_gradeC">
|
|
408 <td>Tasman</td>
|
|
409 <td>Internet Explorer 5.1</td>
|
|
410 <td>Mac OS 7.6-9</td>
|
|
411 <td class="center">1</td>
|
|
412 <td class="center">C</td>
|
|
413 </tr>
|
|
414 <tr class="odd_gradeC">
|
|
415 <td>Tasman</td>
|
|
416 <td>Internet Explorer 5.2</td>
|
|
417 <td>Mac OS 8-X</td>
|
|
418 <td class="center">1</td>
|
|
419 <td class="center">C</td>
|
|
420 </tr>
|
|
421 <tr class="even_gradeA">
|
|
422 <td>Misc</td>
|
|
423 <td>NetFront 3.1</td>
|
|
424 <td>Embedded devices</td>
|
|
425 <td class="center">-</td>
|
|
426 <td class="center">C</td>
|
|
427 </tr>
|
|
428 <tr class="odd_gradeA">
|
|
429 <td>Misc</td>
|
|
430 <td>NetFront 3.4</td>
|
|
431 <td>Embedded devices</td>
|
|
432 <td class="center">-</td>
|
|
433 <td class="center">A</td>
|
|
434 </tr>
|
|
435 <tr class="even_gradeX">
|
|
436 <td>Misc</td>
|
|
437 <td>Dillo 0.8</td>
|
|
438 <td>Embedded devices</td>
|
|
439 <td class="center">-</td>
|
|
440 <td class="center">X</td>
|
|
441 </tr>
|
|
442 <tr class="odd_gradeX">
|
|
443 <td>Misc</td>
|
|
444 <td>Links</td>
|
|
445 <td>Text only</td>
|
|
446 <td class="center">-</td>
|
|
447 <td class="center">X</td>
|
|
448 </tr>
|
|
449 <tr class="even_gradeX">
|
|
450 <td>Misc</td>
|
|
451 <td>Lynx</td>
|
|
452 <td>Text only</td>
|
|
453 <td class="center">-</td>
|
|
454 <td class="center">X</td>
|
|
455 </tr>
|
|
456 <tr class="odd_gradeC">
|
|
457 <td>Misc</td>
|
|
458 <td>IE Mobile</td>
|
|
459 <td>Windows Mobile 6</td>
|
|
460 <td class="center">-</td>
|
|
461 <td class="center">C</td>
|
|
462 </tr>
|
|
463 <tr class="even_gradeC">
|
|
464 <td>Misc</td>
|
|
465 <td>PSP browser</td>
|
|
466 <td>PSP</td>
|
|
467 <td class="center">-</td>
|
|
468 <td class="center">C</td>
|
|
469 </tr>
|
|
470 <tr class="odd_gradeU">
|
|
471 <td>Other browsers</td>
|
|
472 <td>All others</td>
|
|
473 <td>-</td>
|
|
474 <td class="center">-</td>
|
|
475 <td class="center">U</td>
|
|
476 </tr>
|
|
477 </tbody>
|
|
478 </table>
|
|
479 </div>
|
|
480 </form>
|
|
481 <div class="spacer"></div>
|
|
482
|
|
483
|
|
484 <h1>Examples</h1>
|
|
485 <ul>
|
|
486 <li><a href="index.html">Basic initialisation</a></li>
|
|
487 <li><a href="mouseover.html">Activate with a mouseover rather than click</a></li>
|
|
488 <li><a href="text.html">Custom text in the button</a></li>
|
|
489 <li><a href="theme.html">Using with jQuery UI ThemeRoller</a></li>
|
|
490 <li><a href="exclude_columns.html">Excluding columns from the show / hide list</a></li>
|
|
491 <li><a href="two_tables.html">Two tables initialised together - individual controls</a></li>
|
|
492 <li><a href="two_tables_identical.html">Two tables initialised together - shared control</a></li>
|
|
493 <li><a href="style.html">Alternative styling and reset to original</a></li>
|
|
494 <li><a href="title_callback.html">Customisation of the button label with a callback</a></li>
|
|
495 </ul>
|
|
496
|
|
497
|
|
498 <h1>Initialisation code</h1>
|
|
499 <pre>$(document).ready( function () {
|
|
500 $('#example').dataTable( {
|
|
501 "sDom": '<"H"fr>tC<"F"ip>',
|
|
502 "bJQueryUI": true,
|
|
503 "bPaginate": false,
|
|
504 "sScrollY": "200px",
|
|
505 "bScrollCollapse": true,
|
|
506 "bScrollAutoCss": false,
|
|
507 "aoColumnDefs": [
|
|
508 { "bVisible": false, "aTargets": [ 2 ] }
|
|
509 ],
|
|
510 "oColVis": {
|
|
511 "buttonText": "&nbsp;",
|
|
512 "bRestore": true,
|
|
513 "sAlign": "left"
|
|
514 },
|
|
515 "fnDrawCallback": function (o) {
|
|
516 /* Position the ColVis button as needed */
|
|
517 var nColVis = $('div.ColVis', o.nTableWrapper)[0];
|
|
518 nColVis.style.width = o.oScroll.iBarWidth+"px";
|
|
519 nColVis.style.top = ($('div.dataTables_scroll', o.nTableWrapper).position().top)+"px";
|
|
520 nColVis.style.height = ($('div.dataTables_scrollHead table', o.nTableWrapper).height())+"px";
|
|
521 }
|
|
522 } );
|
|
523 } );</pre>
|
|
524
|
|
525 <div id="footer" style="text-align:center;">
|
|
526 <span style="font-size:10px;">
|
|
527 ColVis and DataTables © Allan Jardine 2009-2010
|
|
528 </span>
|
|
529 </div>
|
|
530 </div>
|
|
531 </body>
|
|
532 </html> |