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>ColReorder example</title>
|
|
8 <style type="text/css" title="currentStyle">
|
|
9 @import "../../media/css/demo_page.css";
|
|
10 @import "../../media/css/demo_table.css";
|
|
11 @import "media/css/ColReorder.css";
|
|
12 </style>
|
|
13 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script>
|
|
14 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script>
|
|
15 <script type="text/javascript" charset="utf-8" src="media/js/ColReorder.js"></script>
|
|
16 <script type="text/javascript" charset="utf-8">
|
|
17 $(document).ready( function () {
|
|
18 var oTable = $('#example').dataTable( {
|
|
19 "sDom": 'Rlfrtip',
|
|
20 "oColReorder": {
|
|
21 "aiOrder": [ 4, 3, 2, 1, 0 ]
|
|
22 }
|
|
23 } );
|
|
24
|
|
25 $('#reset').click( function () {
|
|
26 ColReorder.fnReset( oTable );
|
|
27 return false;
|
|
28 } );
|
|
29 } );
|
|
30
|
|
31 /*
|
|
32 * Alternative intialisation using 'new'
|
|
33
|
|
34 $(document).ready( function () {
|
|
35 var oTable = $('#example').dataTable();
|
|
36 var colreorder = new ColReorder( oTable, {
|
|
37 "aiOrder": [ 4, 3, 2, 1, 0 ]
|
|
38 } );
|
|
39
|
|
40 $('#reset').click( function () {
|
|
41 colreorder.fnReset();
|
|
42 return false;
|
|
43 } );
|
|
44 } );
|
|
45
|
|
46 *
|
|
47 */
|
|
48 </script>
|
|
49 </head>
|
|
50 <body id="dt_example">
|
|
51 <div id="container">
|
|
52 <div class="full_width big">
|
|
53 ColReorder example with the ability to reset the ordering
|
|
54 </div>
|
|
55
|
|
56 <h1>Preamble</h1>
|
|
57 <p>One useful control option to present the end user when using ColReorder is the ability
|
|
58 to reset the column ordering to that which was found in the HTML. This can be done by
|
|
59 calling the fnReset API function. While ColReorder does not provide a visual element for
|
|
60 this itself (in order to provide maximum flexibility) it is easy to hook to an event
|
|
61 handler, as shown in this example.</p>
|
|
62
|
|
63 <h1>Live example</h1>
|
|
64 <form>
|
|
65 <div id="demo">
|
|
66 <button id="reset">Reset to original HTML order</button><br><br>
|
|
67
|
|
68 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
|
69 <thead>
|
|
70 <tr>
|
|
71 <th>Rendering engine</th>
|
|
72 <th>Browser</th>
|
|
73 <th>Platform(s)</th>
|
|
74 <th>Engine version</th>
|
|
75 <th>CSS grade</th>
|
|
76 </tr>
|
|
77 </thead>
|
|
78 <tfoot>
|
|
79 <tr>
|
|
80 <th>Rendering engine</th>
|
|
81 <th>Browser</th>
|
|
82 <th>Platform(s)</th>
|
|
83 <th>Engine version</th>
|
|
84 <th>CSS grade</th>
|
|
85 </tr>
|
|
86 </tfoot>
|
|
87 <tbody>
|
|
88 <tr class="odd_gradeX">
|
|
89 <td>Trident</td>
|
|
90 <td>Internet Explorer 4.0</td>
|
|
91 <td>Win 95+ (Entity: &)</td>
|
|
92 <td class="center">4</td>
|
|
93 <td class="center">X</td>
|
|
94 </tr>
|
|
95 <tr class="even_gradeC">
|
|
96 <td>Trident</td>
|
|
97 <td>Internet Explorer 5.0</td>
|
|
98 <td>Win 95+</td>
|
|
99 <td class="center">5</td>
|
|
100 <td class="center">C</td>
|
|
101 </tr>
|
|
102 <tr class="odd_gradeA">
|
|
103 <td>Trident</td>
|
|
104 <td>Internet Explorer 5.5</td>
|
|
105 <td>Win 95+</td>
|
|
106 <td class="center">5.5</td>
|
|
107 <td class="center">A</td>
|
|
108 </tr>
|
|
109 <tr class="even_gradeA">
|
|
110 <td>Trident</td>
|
|
111 <td>Internet Explorer 6</td>
|
|
112 <td>Win 98+</td>
|
|
113 <td class="center">6</td>
|
|
114 <td class="center">A</td>
|
|
115 </tr>
|
|
116 <tr class="odd_gradeA">
|
|
117 <td>Trident</td>
|
|
118 <td>Internet Explorer 7</td>
|
|
119 <td>Win XP SP2+</td>
|
|
120 <td class="center">7</td>
|
|
121 <td class="center">A</td>
|
|
122 </tr>
|
|
123 <tr class="even_gradeA">
|
|
124 <td>Trident</td>
|
|
125 <td>AOL browser (AOL desktop)</td>
|
|
126 <td>Win XP</td>
|
|
127 <td class="center">6</td>
|
|
128 <td class="center">A</td>
|
|
129 </tr>
|
|
130 <tr class="odd_gradeA">
|
|
131 <td>Gecko (UTF-8: $¢€)</td>
|
|
132 <td>Firefox 1.0</td>
|
|
133 <td>Win 98+ / OSX.2+</td>
|
|
134 <td class="center">1.7</td>
|
|
135 <td class="center">A</td>
|
|
136 </tr>
|
|
137 <tr class="even_gradeA">
|
|
138 <td>Gecko</td>
|
|
139 <td>Firefox 1.5</td>
|
|
140 <td>Win 98+ / OSX.2+</td>
|
|
141 <td class="center">1.8</td>
|
|
142 <td class="center">A</td>
|
|
143 </tr>
|
|
144 <tr class="odd_gradeA">
|
|
145 <td>Gecko</td>
|
|
146 <td>Firefox 2.0</td>
|
|
147 <td>Win 98+ / OSX.2+</td>
|
|
148 <td class="center">1.8</td>
|
|
149 <td class="center">A</td>
|
|
150 </tr>
|
|
151 <tr class="even_gradeA">
|
|
152 <td>Gecko</td>
|
|
153 <td>Firefox 3.0</td>
|
|
154 <td>Win 2k+ / OSX.3+</td>
|
|
155 <td class="center">1.9</td>
|
|
156 <td class="center">A</td>
|
|
157 </tr>
|
|
158 <tr class="odd_gradeA">
|
|
159 <td>Gecko</td>
|
|
160 <td>Camino 1.0</td>
|
|
161 <td>OSX.2+</td>
|
|
162 <td class="center">1.8</td>
|
|
163 <td class="center">A</td>
|
|
164 </tr>
|
|
165 <tr class="even_gradeA">
|
|
166 <td>Gecko</td>
|
|
167 <td>Camino 1.5</td>
|
|
168 <td>OSX.3+</td>
|
|
169 <td class="center">1.8</td>
|
|
170 <td class="center">A</td>
|
|
171 </tr>
|
|
172 <tr class="odd_gradeA">
|
|
173 <td>Gecko</td>
|
|
174 <td>Netscape 7.2</td>
|
|
175 <td>Win 95+ / Mac OS 8.6-9.2</td>
|
|
176 <td class="center">1.7</td>
|
|
177 <td class="center">A</td>
|
|
178 </tr>
|
|
179 <tr class="even_gradeA">
|
|
180 <td>Gecko</td>
|
|
181 <td>Netscape Browser 8</td>
|
|
182 <td>Win 98SE+</td>
|
|
183 <td class="center">1.7</td>
|
|
184 <td class="center">A</td>
|
|
185 </tr>
|
|
186 <tr class="odd_gradeA">
|
|
187 <td>Gecko</td>
|
|
188 <td>Netscape Navigator 9</td>
|
|
189 <td>Win 98+ / OSX.2+</td>
|
|
190 <td class="center">1.8</td>
|
|
191 <td class="center">A</td>
|
|
192 </tr>
|
|
193 <tr class="even_gradeA">
|
|
194 <td>Gecko</td>
|
|
195 <td>Mozilla 1.0</td>
|
|
196 <td>Win 95+ / OSX.1+</td>
|
|
197 <td class="center">1</td>
|
|
198 <td class="center">A</td>
|
|
199 </tr>
|
|
200 <tr class="odd_gradeA">
|
|
201 <td>Gecko</td>
|
|
202 <td>Mozilla 1.1</td>
|
|
203 <td>Win 95+ / OSX.1+</td>
|
|
204 <td class="center">1.1</td>
|
|
205 <td class="center">A</td>
|
|
206 </tr>
|
|
207 <tr class="even_gradeA">
|
|
208 <td>Gecko</td>
|
|
209 <td>Mozilla 1.2</td>
|
|
210 <td>Win 95+ / OSX.1+</td>
|
|
211 <td class="center">1.2</td>
|
|
212 <td class="center">A</td>
|
|
213 </tr>
|
|
214 <tr class="odd_gradeA">
|
|
215 <td>Gecko</td>
|
|
216 <td>Mozilla 1.3</td>
|
|
217 <td>Win 95+ / OSX.1+</td>
|
|
218 <td class="center">1.3</td>
|
|
219 <td class="center">A</td>
|
|
220 </tr>
|
|
221 <tr class="even_gradeA">
|
|
222 <td>Gecko</td>
|
|
223 <td>Mozilla 1.4</td>
|
|
224 <td>Win 95+ / OSX.1+</td>
|
|
225 <td class="center">1.4</td>
|
|
226 <td class="center">A</td>
|
|
227 </tr>
|
|
228 <tr class="odd_gradeA">
|
|
229 <td>Gecko</td>
|
|
230 <td>Mozilla 1.5</td>
|
|
231 <td>Win 95+ / OSX.1+</td>
|
|
232 <td class="center">1.5</td>
|
|
233 <td class="center">A</td>
|
|
234 </tr>
|
|
235 <tr class="even_gradeA">
|
|
236 <td>Gecko</td>
|
|
237 <td>Mozilla 1.6</td>
|
|
238 <td>Win 95+ / OSX.1+</td>
|
|
239 <td class="center">1.6</td>
|
|
240 <td class="center">A</td>
|
|
241 </tr>
|
|
242 <tr class="odd_gradeA">
|
|
243 <td>Gecko</td>
|
|
244 <td>Mozilla 1.7</td>
|
|
245 <td>Win 98+ / OSX.1+</td>
|
|
246 <td class="center">1.7</td>
|
|
247 <td class="center">A</td>
|
|
248 </tr>
|
|
249 <tr class="even_gradeA">
|
|
250 <td>Gecko</td>
|
|
251 <td>Mozilla 1.8</td>
|
|
252 <td>Win 98+ / OSX.1+</td>
|
|
253 <td class="center">1.8</td>
|
|
254 <td class="center">A</td>
|
|
255 </tr>
|
|
256 <tr class="odd_gradeA">
|
|
257 <td>Gecko</td>
|
|
258 <td>Seamonkey 1.1</td>
|
|
259 <td>Win 98+ / OSX.2+</td>
|
|
260 <td class="center">1.8</td>
|
|
261 <td class="center">A</td>
|
|
262 </tr>
|
|
263 <tr class="even_gradeA">
|
|
264 <td>Gecko</td>
|
|
265 <td>Epiphany 2.20</td>
|
|
266 <td>Gnome</td>
|
|
267 <td class="center">1.8</td>
|
|
268 <td class="center">A</td>
|
|
269 </tr>
|
|
270 <tr class="odd_gradeA">
|
|
271 <td>Webkit</td>
|
|
272 <td>Safari 1.2</td>
|
|
273 <td>OSX.3</td>
|
|
274 <td class="center">125.5</td>
|
|
275 <td class="center">A</td>
|
|
276 </tr>
|
|
277 <tr class="even_gradeA">
|
|
278 <td>Webkit</td>
|
|
279 <td>Safari 1.3</td>
|
|
280 <td>OSX.3</td>
|
|
281 <td class="center">312.8</td>
|
|
282 <td class="center">A</td>
|
|
283 </tr>
|
|
284 <tr class="odd_gradeA">
|
|
285 <td>Webkit</td>
|
|
286 <td>Safari 2.0</td>
|
|
287 <td>OSX.4+</td>
|
|
288 <td class="center">419.3</td>
|
|
289 <td class="center">A</td>
|
|
290 </tr>
|
|
291 <tr class="even_gradeA">
|
|
292 <td>Webkit</td>
|
|
293 <td>Safari 3.0</td>
|
|
294 <td>OSX.4+</td>
|
|
295 <td class="center">522.1</td>
|
|
296 <td class="center">A</td>
|
|
297 </tr>
|
|
298 <tr class="odd_gradeA">
|
|
299 <td>Webkit</td>
|
|
300 <td>OmniWeb 5.5</td>
|
|
301 <td>OSX.4+</td>
|
|
302 <td class="center">420</td>
|
|
303 <td class="center">A</td>
|
|
304 </tr>
|
|
305 <tr class="even_gradeA">
|
|
306 <td>Webkit</td>
|
|
307 <td>iPod Touch / iPhone</td>
|
|
308 <td>iPod</td>
|
|
309 <td class="center">420.1</td>
|
|
310 <td class="center">A</td>
|
|
311 </tr>
|
|
312 <tr class="odd_gradeA">
|
|
313 <td>Webkit</td>
|
|
314 <td>S60</td>
|
|
315 <td>S60</td>
|
|
316 <td class="center">413</td>
|
|
317 <td class="center">A</td>
|
|
318 </tr>
|
|
319 <tr class="even_gradeA">
|
|
320 <td>Presto</td>
|
|
321 <td>Opera 7.0</td>
|
|
322 <td>Win 95+ / OSX.1+</td>
|
|
323 <td class="center">-</td>
|
|
324 <td class="center">A</td>
|
|
325 </tr>
|
|
326 <tr class="odd_gradeA">
|
|
327 <td>Presto</td>
|
|
328 <td>Opera 7.5</td>
|
|
329 <td>Win 95+ / OSX.2+</td>
|
|
330 <td class="center">-</td>
|
|
331 <td class="center">A</td>
|
|
332 </tr>
|
|
333 <tr class="even_gradeA">
|
|
334 <td>Presto</td>
|
|
335 <td>Opera 8.0</td>
|
|
336 <td>Win 95+ / OSX.2+</td>
|
|
337 <td class="center">-</td>
|
|
338 <td class="center">A</td>
|
|
339 </tr>
|
|
340 <tr class="odd_gradeA">
|
|
341 <td>Presto</td>
|
|
342 <td>Opera 8.5</td>
|
|
343 <td>Win 95+ / OSX.2+</td>
|
|
344 <td class="center">-</td>
|
|
345 <td class="center">A</td>
|
|
346 </tr>
|
|
347 <tr class="even_gradeA">
|
|
348 <td>Presto</td>
|
|
349 <td>Opera 9.0</td>
|
|
350 <td>Win 95+ / OSX.3+</td>
|
|
351 <td class="center">-</td>
|
|
352 <td class="center">A</td>
|
|
353 </tr>
|
|
354 <tr class="odd_gradeA">
|
|
355 <td>Presto</td>
|
|
356 <td>Opera 9.2</td>
|
|
357 <td>Win 88+ / OSX.3+</td>
|
|
358 <td class="center">-</td>
|
|
359 <td class="center">A</td>
|
|
360 </tr>
|
|
361 <tr class="even_gradeA">
|
|
362 <td>Presto</td>
|
|
363 <td>Opera 9.5</td>
|
|
364 <td>Win 88+ / OSX.3+</td>
|
|
365 <td class="center">-</td>
|
|
366 <td class="center">A</td>
|
|
367 </tr>
|
|
368 <tr class="odd_gradeA">
|
|
369 <td>Presto</td>
|
|
370 <td>Opera for Wii</td>
|
|
371 <td>Wii</td>
|
|
372 <td class="center">-</td>
|
|
373 <td class="center">A</td>
|
|
374 </tr>
|
|
375 <tr class="even_gradeA">
|
|
376 <td>Presto</td>
|
|
377 <td>Nokia N800</td>
|
|
378 <td>N800</td>
|
|
379 <td class="center">-</td>
|
|
380 <td class="center">A</td>
|
|
381 </tr>
|
|
382 <tr class="odd_gradeA">
|
|
383 <td>Presto</td>
|
|
384 <td>Nintendo DS browser</td>
|
|
385 <td>Nintendo DS</td>
|
|
386 <td class="center">8.5</td>
|
|
387 <td class="center">C/A<sup>1</sup></td>
|
|
388 </tr>
|
|
389 <tr class="even_gradeC">
|
|
390 <td>KHTML</td>
|
|
391 <td>Konqureror 3.1</td>
|
|
392 <td>KDE 3.1</td>
|
|
393 <td class="center">3.1</td>
|
|
394 <td class="center">C</td>
|
|
395 </tr>
|
|
396 <tr class="odd_gradeA">
|
|
397 <td>KHTML</td>
|
|
398 <td>Konqureror 3.3</td>
|
|
399 <td>KDE 3.3</td>
|
|
400 <td class="center">3.3</td>
|
|
401 <td class="center">A</td>
|
|
402 </tr>
|
|
403 <tr class="even_gradeA">
|
|
404 <td>KHTML</td>
|
|
405 <td>Konqureror 3.5</td>
|
|
406 <td>KDE 3.5</td>
|
|
407 <td class="center">3.5</td>
|
|
408 <td class="center">A</td>
|
|
409 </tr>
|
|
410 <tr class="odd_gradeX">
|
|
411 <td>Tasman</td>
|
|
412 <td>Internet Explorer 4.5</td>
|
|
413 <td>Mac OS 8-9</td>
|
|
414 <td class="center">-</td>
|
|
415 <td class="center">X</td>
|
|
416 </tr>
|
|
417 <tr class="even_gradeC">
|
|
418 <td>Tasman</td>
|
|
419 <td>Internet Explorer 5.1</td>
|
|
420 <td>Mac OS 7.6-9</td>
|
|
421 <td class="center">1</td>
|
|
422 <td class="center">C</td>
|
|
423 </tr>
|
|
424 <tr class="odd_gradeC">
|
|
425 <td>Tasman</td>
|
|
426 <td>Internet Explorer 5.2</td>
|
|
427 <td>Mac OS 8-X</td>
|
|
428 <td class="center">1</td>
|
|
429 <td class="center">C</td>
|
|
430 </tr>
|
|
431 <tr class="even_gradeA">
|
|
432 <td>Misc</td>
|
|
433 <td>NetFront 3.1</td>
|
|
434 <td>Embedded devices</td>
|
|
435 <td class="center">-</td>
|
|
436 <td class="center">C</td>
|
|
437 </tr>
|
|
438 <tr class="odd_gradeA">
|
|
439 <td>Misc</td>
|
|
440 <td>NetFront 3.4</td>
|
|
441 <td>Embedded devices</td>
|
|
442 <td class="center">-</td>
|
|
443 <td class="center">A</td>
|
|
444 </tr>
|
|
445 <tr class="even_gradeX">
|
|
446 <td>Misc</td>
|
|
447 <td>Dillo 0.8</td>
|
|
448 <td>Embedded devices</td>
|
|
449 <td class="center">-</td>
|
|
450 <td class="center">X</td>
|
|
451 </tr>
|
|
452 <tr class="odd_gradeX">
|
|
453 <td>Misc</td>
|
|
454 <td>Links</td>
|
|
455 <td>Text only</td>
|
|
456 <td class="center">-</td>
|
|
457 <td class="center">X</td>
|
|
458 </tr>
|
|
459 <tr class="even_gradeX">
|
|
460 <td>Misc</td>
|
|
461 <td>Lynx</td>
|
|
462 <td>Text only</td>
|
|
463 <td class="center">-</td>
|
|
464 <td class="center">X</td>
|
|
465 </tr>
|
|
466 <tr class="odd_gradeC">
|
|
467 <td>Misc</td>
|
|
468 <td>IE Mobile</td>
|
|
469 <td>Windows Mobile 6</td>
|
|
470 <td class="center">-</td>
|
|
471 <td class="center">C</td>
|
|
472 </tr>
|
|
473 <tr class="even_gradeC">
|
|
474 <td>Misc</td>
|
|
475 <td>PSP browser</td>
|
|
476 <td>PSP</td>
|
|
477 <td class="center">-</td>
|
|
478 <td class="center">C</td>
|
|
479 </tr>
|
|
480 <tr class="odd_gradeU">
|
|
481 <td>Other browsers</td>
|
|
482 <td>All others</td>
|
|
483 <td>-</td>
|
|
484 <td class="center">-</td>
|
|
485 <td class="center">U</td>
|
|
486 </tr>
|
|
487 </tbody>
|
|
488 </table>
|
|
489 </div>
|
|
490 </form>
|
|
491 <div class="spacer"></div>
|
|
492
|
|
493
|
|
494 <h1>Examples</h1>
|
|
495 <ul>
|
|
496 <li><a href="index.html">Basic initialisation</a></li>
|
|
497 <li><a href="alt_insert.html">Styling the insert cursor</a></li>
|
|
498 <li><a href="col_filter.html">Individual column filtering</a></li>
|
|
499 <li><a href="colvis.html">Integration with DataTables' ColVis plug-in</a></li>
|
|
500 <li><a href="fixedcolumns.html">Integration with DataTables' FixedColumns plug-in</a></li>
|
|
501 <li><a href="fixedheader.html">Integration with DataTables' FixedHeader plug-in</a></li>
|
|
502 <li><a href="predefined.html">Using a predefined column order set</a></li>
|
|
503 <li><a href="reset.html">Providing a user control to reset the column order</a></li>
|
|
504 <li><a href="scrolling.html">Column reordering shown with scrolling in DataTables</a></li>
|
|
505 <li><a href="server_side.html">Server-side processing support</a></li>
|
|
506 <li><a href="state_save.html">State saving of the column position</a></li>
|
|
507 <li><a href="theme.html">jQuery UI theme integration</a></li>
|
|
508 </ul>
|
|
509
|
|
510
|
|
511 <h1>Initialisation code</h1>
|
|
512 <pre>$(document).ready( function () {
|
|
513 var oTable = $('#example').dataTable( {
|
|
514 "sDom": 'Rlfrtip',
|
|
515 "oColReorder": {
|
|
516 "aiOrder": [ 4, 3, 2, 1, 0 ]
|
|
517 }
|
|
518 } );
|
|
519
|
|
520 $('#reset').click( function () {
|
|
521 ColReorder.fnReset( oTable );
|
|
522 return false;
|
|
523 } );
|
|
524 } );</pre>
|
|
525
|
|
526 <div id="footer" style="text-align:center;">
|
|
527 <span style="font-size:10px;">
|
|
528 ColReorder and DataTables © Allan Jardine 2010
|
|
529 </span>
|
|
530 </div>
|
|
531 </div>
|
|
532 </body>
|
|
533 </html> |