Mercurial > repos > saskia-hiltemann > ireport
comparison DataTables-1.9.4/examples/plug-ins/paging_plugin.html @ 0:ac5f9272033b draft
first upload
author | saskia-hiltemann |
---|---|
date | Tue, 01 Jul 2014 11:42:23 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ac5f9272033b |
---|---|
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.datatables.net/media/images/favicon.ico" /> | |
6 | |
7 <title>DataTables example</title> | |
8 <style type="text/css" title="currentStyle"> | |
9 @import "../../media/css/demo_page.css"; | |
10 @import "../../media/css/demo_table.css"; | |
11 </style> | |
12 <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script> | |
13 <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script> | |
14 <script type="text/javascript" charset="utf-8"> | |
15 /* Time between each scrolling frame */ | |
16 $.fn.dataTableExt.oPagination.iTweenTime = 100; | |
17 | |
18 $.fn.dataTableExt.oPagination.scrolling = { | |
19 "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) | |
20 { | |
21 var oLang = oSettings.oLanguage.oPaginate; | |
22 var oClasses = oSettings.oClasses; | |
23 var fnClickHandler = function ( e ) { | |
24 if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) ) | |
25 { | |
26 fnCallbackDraw( oSettings ); | |
27 } | |
28 }; | |
29 | |
30 var sAppend = (!oSettings.bJUI) ? | |
31 '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sPrevious+'</a>'+ | |
32 '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sNext+'</a>' | |
33 : | |
34 '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUIPrev+'"></span></a>'+ | |
35 '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUINext+'"></span></a>'; | |
36 $(nPaging).append( sAppend ); | |
37 | |
38 var els = $('a', nPaging); | |
39 var nPrevious = els[0], | |
40 nNext = els[1]; | |
41 | |
42 oSettings.oApi._fnBindAction( nPrevious, {action: "previous"}, function() { | |
43 /* Disallow paging event during a current paging event */ | |
44 if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 ) | |
45 { | |
46 return; | |
47 } | |
48 | |
49 oSettings.iPagingLoopStart = oSettings._iDisplayStart; | |
50 oSettings.iPagingEnd = oSettings._iDisplayStart - oSettings._iDisplayLength; | |
51 | |
52 /* Correct for underrun */ | |
53 if ( oSettings.iPagingEnd < 0 ) | |
54 { | |
55 oSettings.iPagingEnd = 0; | |
56 } | |
57 | |
58 var iTween = $.fn.dataTableExt.oPagination.iTweenTime; | |
59 var innerLoop = function () { | |
60 if ( oSettings.iPagingLoopStart > oSettings.iPagingEnd ) { | |
61 oSettings.iPagingLoopStart--; | |
62 oSettings._iDisplayStart = oSettings.iPagingLoopStart; | |
63 fnCallbackDraw( oSettings ); | |
64 setTimeout( function() { innerLoop(); }, iTween ); | |
65 } else { | |
66 oSettings.iPagingLoopStart = -1; | |
67 } | |
68 }; | |
69 innerLoop(); | |
70 } ); | |
71 | |
72 oSettings.oApi._fnBindAction( nNext, {action: "next"}, function() { | |
73 /* Disallow paging event during a current paging event */ | |
74 if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 ) | |
75 { | |
76 return; | |
77 } | |
78 | |
79 oSettings.iPagingLoopStart = oSettings._iDisplayStart; | |
80 | |
81 /* Make sure we are not over running the display array */ | |
82 if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() ) | |
83 { | |
84 oSettings.iPagingEnd = oSettings._iDisplayStart + oSettings._iDisplayLength; | |
85 } | |
86 | |
87 var iTween = $.fn.dataTableExt.oPagination.iTweenTime; | |
88 var innerLoop = function () { | |
89 if ( oSettings.iPagingLoopStart < oSettings.iPagingEnd ) { | |
90 oSettings.iPagingLoopStart++; | |
91 oSettings._iDisplayStart = oSettings.iPagingLoopStart; | |
92 fnCallbackDraw( oSettings ); | |
93 setTimeout( function() { innerLoop(); }, iTween ); | |
94 } else { | |
95 oSettings.iPagingLoopStart = -1; | |
96 } | |
97 }; | |
98 innerLoop(); | |
99 } ); | |
100 }, | |
101 | |
102 "fnUpdate": function ( oSettings, fnCallbackDraw ) | |
103 { | |
104 if ( !oSettings.aanFeatures.p ) | |
105 { | |
106 return; | |
107 } | |
108 | |
109 /* Loop over each instance of the pager */ | |
110 var an = oSettings.aanFeatures.p; | |
111 for ( var i=0, iLen=an.length ; i<iLen ; i++ ) | |
112 { | |
113 if ( an[i].childNodes.length !== 0 ) | |
114 { | |
115 an[i].childNodes[0].className = | |
116 ( oSettings._iDisplayStart === 0 ) ? | |
117 oSettings.oClasses.sPagePrevDisabled : oSettings.oClasses.sPagePrevEnabled; | |
118 | |
119 an[i].childNodes[1].className = | |
120 ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ? | |
121 oSettings.oClasses.sPageNextDisabled : oSettings.oClasses.sPageNextEnabled; | |
122 } | |
123 } | |
124 } | |
125 } | |
126 | |
127 $(document).ready(function() { | |
128 $('#example').dataTable( { | |
129 "sPaginationType": "scrolling" | |
130 } ); | |
131 } ); | |
132 </script> | |
133 </head> | |
134 <body id="dt_example"> | |
135 <div id="container"> | |
136 <div class="full_width big"> | |
137 DataTables custom pagination plug-in example | |
138 </div> | |
139 | |
140 <h1>Preamble</h1> | |
141 <p>The two default pagination styles that DataTables comes with are great for basic tables, but you might which to add extra customisation or a bit of 'glitz'. This plug-in will scroll the table in an animated style.</p> | |
142 | |
143 <h1>Live example</h1> | |
144 <div id="demo"> | |
145 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> | |
146 <thead> | |
147 <tr> | |
148 <th>Rendering engine</th> | |
149 <th>Browser</th> | |
150 <th>Platform(s)</th> | |
151 <th>Engine version</th> | |
152 <th>CSS grade</th> | |
153 </tr> | |
154 </thead> | |
155 <tbody> | |
156 <tr class="gradeX"> | |
157 <td>Trident</td> | |
158 <td>Internet | |
159 Explorer 4.0</td> | |
160 <td>Win 95+</td> | |
161 <td class="center">4</td> | |
162 <td class="center">X</td> | |
163 </tr> | |
164 <tr class="gradeC"> | |
165 <td>Trident</td> | |
166 <td>Internet | |
167 Explorer 5.0</td> | |
168 <td>Win 95+</td> | |
169 <td class="center">5</td> | |
170 <td class="center">C</td> | |
171 </tr> | |
172 <tr class="gradeA"> | |
173 <td>Trident</td> | |
174 <td>Internet | |
175 Explorer 5.5</td> | |
176 <td>Win 95+</td> | |
177 <td class="center">5.5</td> | |
178 <td class="center">A</td> | |
179 </tr> | |
180 <tr class="gradeA"> | |
181 <td>Trident</td> | |
182 <td>Internet | |
183 Explorer 6</td> | |
184 <td>Win 98+</td> | |
185 <td class="center">6</td> | |
186 <td class="center">A</td> | |
187 </tr> | |
188 <tr class="gradeA"> | |
189 <td>Trident</td> | |
190 <td>Internet Explorer 7</td> | |
191 <td>Win XP SP2+</td> | |
192 <td class="center">7</td> | |
193 <td class="center">A</td> | |
194 </tr> | |
195 <tr class="gradeA"> | |
196 <td>Trident</td> | |
197 <td>AOL browser (AOL desktop)</td> | |
198 <td>Win XP</td> | |
199 <td class="center">6</td> | |
200 <td class="center">A</td> | |
201 </tr> | |
202 <tr class="gradeA"> | |
203 <td>Gecko</td> | |
204 <td>Firefox 1.0</td> | |
205 <td>Win 98+ / OSX.2+</td> | |
206 <td class="center">1.7</td> | |
207 <td class="center">A</td> | |
208 </tr> | |
209 <tr class="gradeA"> | |
210 <td>Gecko</td> | |
211 <td>Firefox 1.5</td> | |
212 <td>Win 98+ / OSX.2+</td> | |
213 <td class="center">1.8</td> | |
214 <td class="center">A</td> | |
215 </tr> | |
216 <tr class="gradeA"> | |
217 <td>Gecko</td> | |
218 <td>Firefox 2.0</td> | |
219 <td>Win 98+ / OSX.2+</td> | |
220 <td class="center">1.8</td> | |
221 <td class="center">A</td> | |
222 </tr> | |
223 <tr class="gradeA"> | |
224 <td>Gecko</td> | |
225 <td>Firefox 3.0</td> | |
226 <td>Win 2k+ / OSX.3+</td> | |
227 <td class="center">1.9</td> | |
228 <td class="center">A</td> | |
229 </tr> | |
230 <tr class="gradeA"> | |
231 <td>Gecko</td> | |
232 <td>Camino 1.0</td> | |
233 <td>OSX.2+</td> | |
234 <td class="center">1.8</td> | |
235 <td class="center">A</td> | |
236 </tr> | |
237 <tr class="gradeA"> | |
238 <td>Gecko</td> | |
239 <td>Camino 1.5</td> | |
240 <td>OSX.3+</td> | |
241 <td class="center">1.8</td> | |
242 <td class="center">A</td> | |
243 </tr> | |
244 <tr class="gradeA"> | |
245 <td>Gecko</td> | |
246 <td>Netscape 7.2</td> | |
247 <td>Win 95+ / Mac OS 8.6-9.2</td> | |
248 <td class="center">1.7</td> | |
249 <td class="center">A</td> | |
250 </tr> | |
251 <tr class="gradeA"> | |
252 <td>Gecko</td> | |
253 <td>Netscape Browser 8</td> | |
254 <td>Win 98SE+</td> | |
255 <td class="center">1.7</td> | |
256 <td class="center">A</td> | |
257 </tr> | |
258 <tr class="gradeA"> | |
259 <td>Gecko</td> | |
260 <td>Netscape Navigator 9</td> | |
261 <td>Win 98+ / OSX.2+</td> | |
262 <td class="center">1.8</td> | |
263 <td class="center">A</td> | |
264 </tr> | |
265 <tr class="gradeA"> | |
266 <td>Gecko</td> | |
267 <td>Mozilla 1.0</td> | |
268 <td>Win 95+ / OSX.1+</td> | |
269 <td class="center">1</td> | |
270 <td class="center">A</td> | |
271 </tr> | |
272 <tr class="gradeA"> | |
273 <td>Gecko</td> | |
274 <td>Mozilla 1.1</td> | |
275 <td>Win 95+ / OSX.1+</td> | |
276 <td class="center">1.1</td> | |
277 <td class="center">A</td> | |
278 </tr> | |
279 <tr class="gradeA"> | |
280 <td>Gecko</td> | |
281 <td>Mozilla 1.2</td> | |
282 <td>Win 95+ / OSX.1+</td> | |
283 <td class="center">1.2</td> | |
284 <td class="center">A</td> | |
285 </tr> | |
286 <tr class="gradeA"> | |
287 <td>Gecko</td> | |
288 <td>Mozilla 1.3</td> | |
289 <td>Win 95+ / OSX.1+</td> | |
290 <td class="center">1.3</td> | |
291 <td class="center">A</td> | |
292 </tr> | |
293 <tr class="gradeA"> | |
294 <td>Gecko</td> | |
295 <td>Mozilla 1.4</td> | |
296 <td>Win 95+ / OSX.1+</td> | |
297 <td class="center">1.4</td> | |
298 <td class="center">A</td> | |
299 </tr> | |
300 <tr class="gradeA"> | |
301 <td>Gecko</td> | |
302 <td>Mozilla 1.5</td> | |
303 <td>Win 95+ / OSX.1+</td> | |
304 <td class="center">1.5</td> | |
305 <td class="center">A</td> | |
306 </tr> | |
307 <tr class="gradeA"> | |
308 <td>Gecko</td> | |
309 <td>Mozilla 1.6</td> | |
310 <td>Win 95+ / OSX.1+</td> | |
311 <td class="center">1.6</td> | |
312 <td class="center">A</td> | |
313 </tr> | |
314 <tr class="gradeA"> | |
315 <td>Gecko</td> | |
316 <td>Mozilla 1.7</td> | |
317 <td>Win 98+ / OSX.1+</td> | |
318 <td class="center">1.7</td> | |
319 <td class="center">A</td> | |
320 </tr> | |
321 <tr class="gradeA"> | |
322 <td>Gecko</td> | |
323 <td>Mozilla 1.8</td> | |
324 <td>Win 98+ / OSX.1+</td> | |
325 <td class="center">1.8</td> | |
326 <td class="center">A</td> | |
327 </tr> | |
328 <tr class="gradeA"> | |
329 <td>Gecko</td> | |
330 <td>Seamonkey 1.1</td> | |
331 <td>Win 98+ / OSX.2+</td> | |
332 <td class="center">1.8</td> | |
333 <td class="center">A</td> | |
334 </tr> | |
335 <tr class="gradeA"> | |
336 <td>Gecko</td> | |
337 <td>Epiphany 2.20</td> | |
338 <td>Gnome</td> | |
339 <td class="center">1.8</td> | |
340 <td class="center">A</td> | |
341 </tr> | |
342 <tr class="gradeA"> | |
343 <td>Webkit</td> | |
344 <td>Safari 1.2</td> | |
345 <td>OSX.3</td> | |
346 <td class="center">125.5</td> | |
347 <td class="center">A</td> | |
348 </tr> | |
349 <tr class="gradeA"> | |
350 <td>Webkit</td> | |
351 <td>Safari 1.3</td> | |
352 <td>OSX.3</td> | |
353 <td class="center">312.8</td> | |
354 <td class="center">A</td> | |
355 </tr> | |
356 <tr class="gradeA"> | |
357 <td>Webkit</td> | |
358 <td>Safari 2.0</td> | |
359 <td>OSX.4+</td> | |
360 <td class="center">419.3</td> | |
361 <td class="center">A</td> | |
362 </tr> | |
363 <tr class="gradeA"> | |
364 <td>Webkit</td> | |
365 <td>Safari 3.0</td> | |
366 <td>OSX.4+</td> | |
367 <td class="center">522.1</td> | |
368 <td class="center">A</td> | |
369 </tr> | |
370 <tr class="gradeA"> | |
371 <td>Webkit</td> | |
372 <td>OmniWeb 5.5</td> | |
373 <td>OSX.4+</td> | |
374 <td class="center">420</td> | |
375 <td class="center">A</td> | |
376 </tr> | |
377 <tr class="gradeA"> | |
378 <td>Webkit</td> | |
379 <td>iPod Touch / iPhone</td> | |
380 <td>iPod</td> | |
381 <td class="center">420.1</td> | |
382 <td class="center">A</td> | |
383 </tr> | |
384 <tr class="gradeA"> | |
385 <td>Webkit</td> | |
386 <td>S60</td> | |
387 <td>S60</td> | |
388 <td class="center">413</td> | |
389 <td class="center">A</td> | |
390 </tr> | |
391 <tr class="gradeA"> | |
392 <td>Presto</td> | |
393 <td>Opera 7.0</td> | |
394 <td>Win 95+ / OSX.1+</td> | |
395 <td class="center">-</td> | |
396 <td class="center">A</td> | |
397 </tr> | |
398 <tr class="gradeA"> | |
399 <td>Presto</td> | |
400 <td>Opera 7.5</td> | |
401 <td>Win 95+ / OSX.2+</td> | |
402 <td class="center">-</td> | |
403 <td class="center">A</td> | |
404 </tr> | |
405 <tr class="gradeA"> | |
406 <td>Presto</td> | |
407 <td>Opera 8.0</td> | |
408 <td>Win 95+ / OSX.2+</td> | |
409 <td class="center">-</td> | |
410 <td class="center">A</td> | |
411 </tr> | |
412 <tr class="gradeA"> | |
413 <td>Presto</td> | |
414 <td>Opera 8.5</td> | |
415 <td>Win 95+ / OSX.2+</td> | |
416 <td class="center">-</td> | |
417 <td class="center">A</td> | |
418 </tr> | |
419 <tr class="gradeA"> | |
420 <td>Presto</td> | |
421 <td>Opera 9.0</td> | |
422 <td>Win 95+ / OSX.3+</td> | |
423 <td class="center">-</td> | |
424 <td class="center">A</td> | |
425 </tr> | |
426 <tr class="gradeA"> | |
427 <td>Presto</td> | |
428 <td>Opera 9.2</td> | |
429 <td>Win 88+ / OSX.3+</td> | |
430 <td class="center">-</td> | |
431 <td class="center">A</td> | |
432 </tr> | |
433 <tr class="gradeA"> | |
434 <td>Presto</td> | |
435 <td>Opera 9.5</td> | |
436 <td>Win 88+ / OSX.3+</td> | |
437 <td class="center">-</td> | |
438 <td class="center">A</td> | |
439 </tr> | |
440 <tr class="gradeA"> | |
441 <td>Presto</td> | |
442 <td>Opera for Wii</td> | |
443 <td>Wii</td> | |
444 <td class="center">-</td> | |
445 <td class="center">A</td> | |
446 </tr> | |
447 <tr class="gradeA"> | |
448 <td>Presto</td> | |
449 <td>Nokia N800</td> | |
450 <td>N800</td> | |
451 <td class="center">-</td> | |
452 <td class="center">A</td> | |
453 </tr> | |
454 <tr class="gradeA"> | |
455 <td>Presto</td> | |
456 <td>Nintendo DS browser</td> | |
457 <td>Nintendo DS</td> | |
458 <td class="center">8.5</td> | |
459 <td class="center">C/A<sup>1</sup></td> | |
460 </tr> | |
461 <tr class="gradeC"> | |
462 <td>KHTML</td> | |
463 <td>Konqureror 3.1</td> | |
464 <td>KDE 3.1</td> | |
465 <td class="center">3.1</td> | |
466 <td class="center">C</td> | |
467 </tr> | |
468 <tr class="gradeA"> | |
469 <td>KHTML</td> | |
470 <td>Konqureror 3.3</td> | |
471 <td>KDE 3.3</td> | |
472 <td class="center">3.3</td> | |
473 <td class="center">A</td> | |
474 </tr> | |
475 <tr class="gradeA"> | |
476 <td>KHTML</td> | |
477 <td>Konqureror 3.5</td> | |
478 <td>KDE 3.5</td> | |
479 <td class="center">3.5</td> | |
480 <td class="center">A</td> | |
481 </tr> | |
482 <tr class="gradeX"> | |
483 <td>Tasman</td> | |
484 <td>Internet Explorer 4.5</td> | |
485 <td>Mac OS 8-9</td> | |
486 <td class="center">-</td> | |
487 <td class="center">X</td> | |
488 </tr> | |
489 <tr class="gradeC"> | |
490 <td>Tasman</td> | |
491 <td>Internet Explorer 5.1</td> | |
492 <td>Mac OS 7.6-9</td> | |
493 <td class="center">1</td> | |
494 <td class="center">C</td> | |
495 </tr> | |
496 <tr class="gradeC"> | |
497 <td>Tasman</td> | |
498 <td>Internet Explorer 5.2</td> | |
499 <td>Mac OS 8-X</td> | |
500 <td class="center">1</td> | |
501 <td class="center">C</td> | |
502 </tr> | |
503 <tr class="gradeA"> | |
504 <td>Misc</td> | |
505 <td>NetFront 3.1</td> | |
506 <td>Embedded devices</td> | |
507 <td class="center">-</td> | |
508 <td class="center">C</td> | |
509 </tr> | |
510 <tr class="gradeA"> | |
511 <td>Misc</td> | |
512 <td>NetFront 3.4</td> | |
513 <td>Embedded devices</td> | |
514 <td class="center">-</td> | |
515 <td class="center">A</td> | |
516 </tr> | |
517 <tr class="gradeX"> | |
518 <td>Misc</td> | |
519 <td>Dillo 0.8</td> | |
520 <td>Embedded devices</td> | |
521 <td class="center">-</td> | |
522 <td class="center">X</td> | |
523 </tr> | |
524 <tr class="gradeX"> | |
525 <td>Misc</td> | |
526 <td>Links</td> | |
527 <td>Text only</td> | |
528 <td class="center">-</td> | |
529 <td class="center">X</td> | |
530 </tr> | |
531 <tr class="gradeX"> | |
532 <td>Misc</td> | |
533 <td>Lynx</td> | |
534 <td>Text only</td> | |
535 <td class="center">-</td> | |
536 <td class="center">X</td> | |
537 </tr> | |
538 <tr class="gradeC"> | |
539 <td>Misc</td> | |
540 <td>IE Mobile</td> | |
541 <td>Windows Mobile 6</td> | |
542 <td class="center">-</td> | |
543 <td class="center">C</td> | |
544 </tr> | |
545 <tr class="gradeC"> | |
546 <td>Misc</td> | |
547 <td>PSP browser</td> | |
548 <td>PSP</td> | |
549 <td class="center">-</td> | |
550 <td class="center">C</td> | |
551 </tr> | |
552 <tr class="gradeU"> | |
553 <td>Other browsers</td> | |
554 <td>All others</td> | |
555 <td>-</td> | |
556 <td class="center">-</td> | |
557 <td class="center">U</td> | |
558 </tr> | |
559 </tbody> | |
560 <tfoot> | |
561 <tr> | |
562 <th>Rendering engine</th> | |
563 <th>Browser</th> | |
564 <th>Platform(s)</th> | |
565 <th>Engine version</th> | |
566 <th>CSS grade</th> | |
567 </tr> | |
568 </tfoot> | |
569 </table> | |
570 </div> | |
571 <div class="spacer"></div> | |
572 | |
573 | |
574 <h1>Initialisation code</h1> | |
575 <pre class="brush: js;">/* Time between each scrolling frame */ | |
576 $.fn.dataTableExt.oPagination.iTweenTime = 100; | |
577 | |
578 $.fn.dataTableExt.oPagination.scrolling = { | |
579 "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) | |
580 { | |
581 /* Store the next and previous elements in the oSettings object as they can be very | |
582 * usful for automation - particularly testing | |
583 */ | |
584 var nPrevious = document.createElement( 'div' ); | |
585 var nNext = document.createElement( 'div' ); | |
586 | |
587 if ( oSettings.sTableId !== '' ) | |
588 { | |
589 nPaging.setAttribute( 'id', oSettings.sTableId+'_paginate' ); | |
590 nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' ); | |
591 nNext.setAttribute( 'id', oSettings.sTableId+'_next' ); | |
592 } | |
593 | |
594 nPrevious.className = "paginate_disabled_previous"; | |
595 nNext.className = "paginate_disabled_next"; | |
596 | |
597 nPrevious.title = oSettings.oLanguage.oPaginate.sPrevious; | |
598 nNext.title = oSettings.oLanguage.oPaginate.sNext; | |
599 | |
600 nPaging.appendChild( nPrevious ); | |
601 nPaging.appendChild( nNext ); | |
602 | |
603 $(nPrevious).click( function() { | |
604 /* Disallow paging event during a current paging event */ | |
605 if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 ) | |
606 { | |
607 return; | |
608 } | |
609 | |
610 oSettings.iPagingLoopStart = oSettings._iDisplayStart; | |
611 oSettings.iPagingEnd = oSettings._iDisplayStart - oSettings._iDisplayLength; | |
612 | |
613 /* Correct for underrun */ | |
614 if ( oSettings.iPagingEnd < 0 ) | |
615 { | |
616 oSettings.iPagingEnd = 0; | |
617 } | |
618 | |
619 var iTween = $.fn.dataTableExt.oPagination.iTweenTime; | |
620 var innerLoop = function () { | |
621 if ( oSettings.iPagingLoopStart > oSettings.iPagingEnd ) { | |
622 oSettings.iPagingLoopStart--; | |
623 oSettings._iDisplayStart = oSettings.iPagingLoopStart; | |
624 fnCallbackDraw( oSettings ); | |
625 setTimeout( function() { innerLoop(); }, iTween ); | |
626 } else { | |
627 oSettings.iPagingLoopStart = -1; | |
628 } | |
629 }; | |
630 innerLoop(); | |
631 } ); | |
632 | |
633 $(nNext).click( function() { | |
634 /* Disallow paging event during a current paging event */ | |
635 if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 ) | |
636 { | |
637 return; | |
638 } | |
639 | |
640 oSettings.iPagingLoopStart = oSettings._iDisplayStart; | |
641 | |
642 /* Make sure we are not over running the display array */ | |
643 if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() ) | |
644 { | |
645 oSettings.iPagingEnd = oSettings._iDisplayStart + oSettings._iDisplayLength; | |
646 } | |
647 | |
648 var iTween = $.fn.dataTableExt.oPagination.iTweenTime; | |
649 var innerLoop = function () { | |
650 if ( oSettings.iPagingLoopStart < oSettings.iPagingEnd ) { | |
651 oSettings.iPagingLoopStart++; | |
652 oSettings._iDisplayStart = oSettings.iPagingLoopStart; | |
653 fnCallbackDraw( oSettings ); | |
654 setTimeout( function() { innerLoop(); }, iTween ); | |
655 } else { | |
656 oSettings.iPagingLoopStart = -1; | |
657 } | |
658 }; | |
659 innerLoop(); | |
660 } ); | |
661 | |
662 /* Take the brutal approach to cancelling text selection */ | |
663 $(nPrevious).bind( 'selectstart', function () { return false; } ); | |
664 $(nNext).bind( 'selectstart', function () { return false; } ); | |
665 }, | |
666 | |
667 "fnUpdate": function ( oSettings, fnCallbackDraw ) | |
668 { | |
669 if ( !oSettings.aanFeatures.p ) | |
670 { | |
671 return; | |
672 } | |
673 | |
674 /* Loop over each instance of the pager */ | |
675 var an = oSettings.aanFeatures.p; | |
676 for ( var i=0, iLen=an.length ; i<iLen ; i++ ) | |
677 { | |
678 if ( an[i].childNodes.length !== 0 ) | |
679 { | |
680 an[i].childNodes[0].className = | |
681 ( oSettings._iDisplayStart === 0 ) ? | |
682 oSettings.oClasses.sPagePrevDisabled : oSettings.oClasses.sPagePrevEnabled; | |
683 | |
684 an[i].childNodes[1].className = | |
685 ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ? | |
686 oSettings.oClasses.sPageNextDisabled : oSettings.oClasses.sPageNextEnabled; | |
687 } | |
688 } | |
689 } | |
690 } | |
691 | |
692 $(document).ready(function() { | |
693 $('#example').dataTable( { | |
694 "sPaginationType": "scrolling" | |
695 } ); | |
696 } );</pre> | |
697 <style type="text/css"> | |
698 @import "../examples_support/syntax/css/shCore.css"; | |
699 </style> | |
700 <script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script> | |
701 | |
702 | |
703 <h1>Other examples</h1> | |
704 <div class="demo_links"> | |
705 <h2>Basic initialisation</h2> | |
706 <ul> | |
707 <li><a href="../basic_init/zero_config.html">Zero configuration</a></li> | |
708 <li><a href="../basic_init/filter_only.html">Feature enablement</a></li> | |
709 <li><a href="../basic_init/table_sorting.html">Sorting data</a></li> | |
710 <li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li> | |
711 <li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li> | |
712 <li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li> | |
713 <li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li> | |
714 <li><a href="../basic_init/dom.html">DOM positioning</a></li> | |
715 <li><a href="../basic_init/flexible_width.html">Flexible table width</a></li> | |
716 <li><a href="../basic_init/state_save.html">State saving</a></li> | |
717 <li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li> | |
718 <li>Scrolling: <br> | |
719 <a href="../basic_init/scroll_x.html">Horizontal</a> / | |
720 <a href="../basic_init/scroll_y.html">Vertical</a> / | |
721 <a href="../basic_init/scroll_xy.html">Both</a> / | |
722 <a href="../basic_init/scroll_y_theme.html">Themed</a> / | |
723 <a href="../basic_init/scroll_y_infinite.html">Infinite</a> | |
724 </li> | |
725 <li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li> | |
726 <li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li> | |
727 </ul> | |
728 | |
729 <h2>Advanced initialisation</h2> | |
730 <ul> | |
731 <li>Events: <br> | |
732 <a href="../advanced_init/events_live.html">Live events</a> / | |
733 <a href="../advanced_init/events_pre_init.html">Pre-init</a> / | |
734 <a href="../advanced_init/events_post_init.html">Post-init</a> | |
735 </li> | |
736 <li><a href="../advanced_init/column_render.html">Column rendering</a></li> | |
737 <li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li> | |
738 <li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li> | |
739 <li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li> | |
740 <li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li> | |
741 <li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li> | |
742 <li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li> | |
743 <li><a href="../advanced_init/row_grouping.html">Row grouping</a></li> | |
744 <li><a href="../advanced_init/row_callback.html">Row callback</a></li> | |
745 <li><a href="../advanced_init/footer_callback.html">Footer callback</a></li> | |
746 <li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li> | |
747 <li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li> | |
748 <li><a href="../advanced_init/defaults.html">Setting defaults</a></li> | |
749 <li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li> | |
750 <li><a href="../advanced_init/dt_events.html">Custom events</a></li> | |
751 </ul> | |
752 | |
753 <h2>API</h2> | |
754 <ul> | |
755 <li><a href="../api/add_row.html">Dynamically add a new row</a></li> | |
756 <li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li> | |
757 <li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li> | |
758 <li><a href="../api/highlight.html">Highlight rows and columns</a></li> | |
759 <li><a href="../api/row_details.html">Show and hide details about a particular record</a></li> | |
760 <li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li> | |
761 <li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li> | |
762 <li><a href="../api/editable.html">Editable rows (with jEditable)</a></li> | |
763 <li><a href="../api/form.html">Submit form with elements in table</a></li> | |
764 <li><a href="../api/counter_column.html">Index column (static number column)</a></li> | |
765 <li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li> | |
766 <li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li> | |
767 <li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li> | |
768 <li><a href="../api/regex.html">Regular expression filtering</a></li> | |
769 </ul> | |
770 </div> | |
771 | |
772 <div class="demo_links"> | |
773 <h2>Data sources</h2> | |
774 <ul> | |
775 <li><a href="../data_sources/dom.html">DOM</a></li> | |
776 <li><a href="../data_sources/js_array.html">Javascript array</a></li> | |
777 <li><a href="../data_sources/ajax.html">Ajax source</a></li> | |
778 <li><a href="../data_sources/server_side.html">Server side processing</a></li> | |
779 </ul> | |
780 | |
781 <h2>Server-side processing</h2> | |
782 <ul> | |
783 <li><a href="../server_side/server_side.html">Obtain server-side data</a></li> | |
784 <li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li> | |
785 <li><a href="../server_side/post.html">Use HTTP POST</a></li> | |
786 <li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li> | |
787 <li><a href="../server_side/object_data.html">Reading table data from objects</a></li> | |
788 <li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li> | |
789 <li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li> | |
790 <li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li> | |
791 <li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li> | |
792 <li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li> | |
793 <li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li> | |
794 </ul> | |
795 | |
796 <h2>Ajax data source</h2> | |
797 <ul> | |
798 <li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li> | |
799 <li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li> | |
800 <li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li> | |
801 <li><a href="../ajax/null_data_source.html">Empty data source columns</a></li> | |
802 <li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li> | |
803 <li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li> | |
804 <li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li> | |
805 </ul> | |
806 | |
807 <h2>Plug-ins</h2> | |
808 <ul> | |
809 <li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li> | |
810 <li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li> | |
811 <li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li> | |
812 <li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li> | |
813 <li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li> | |
814 <li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li> | |
815 <li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li> | |
816 </ul> | |
817 </div> | |
818 | |
819 | |
820 <div id="footer" class="clear" style="text-align:center;"> | |
821 <p> | |
822 Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br> | |
823 Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables. | |
824 </p> | |
825 | |
826 <span style="font-size:10px;"> | |
827 DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br> | |
828 DataTables is dual licensed under the <a href="http://www.datatables.net/license_gpl2">GPL v2 license</a> or a <a href="http://www.datatables.net/license_bsd">BSD (3-point) license</a>. | |
829 </span> | |
830 </div> | |
831 </div> | |
832 </body> | |
833 </html> |