paging_plugin.html 26 KB

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