Permalink
Browse files

Examples: Update - Scrolling paging plug-in now uses A tags (based on…

… the updated two button paging for 1.9), has full accessaibility and jQuery UI support
  • Loading branch information...
1 parent af2e153 commit 273aab7e5977162dbd31e2b5896aeb8c0fc191ae @DataTables committed Feb 16, 2012
Showing with 22 additions and 27 deletions.
  1. +22 −27 examples/plug-ins/paging_plugin.html
@@ -18,29 +18,28 @@
$.fn.dataTableExt.oPagination.scrolling = {
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
{
- /* Store the next and previous elements in the oSettings object as they can be very
- * usful for automation - particularly testing
- */
- var nPrevious = document.createElement( 'div' );
- var nNext = document.createElement( 'div' );
-
- if ( oSettings.sTableId !== '' )
- {
- nPaging.setAttribute( 'id', oSettings.sTableId+'_paginate' );
- nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' );
- nNext.setAttribute( 'id', oSettings.sTableId+'_next' );
- }
-
- nPrevious.className = "paginate_disabled_previous";
- nNext.className = "paginate_disabled_next";
-
- nPrevious.title = oSettings.oLanguage.oPaginate.sPrevious;
- nNext.title = oSettings.oLanguage.oPaginate.sNext;
+ var oLang = oSettings.oLanguage.oPaginate;
+ var oClasses = oSettings.oClasses;
+ var fnClickHandler = function ( e ) {
+ if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
+ {
+ fnCallbackDraw( oSettings );
+ }
+ };
+
+ var sAppend = (!oSettings.bJUI) ?
+ '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sPrevious+'</a>'+
+ '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sNext+'</a>'
+ :
+ '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUIPrev+'"></span></a>'+
+ '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUINext+'"></span></a>';
+ $(nPaging).append( sAppend );
- nPaging.appendChild( nPrevious );
- nPaging.appendChild( nNext );
+ var els = $('a', nPaging);
+ var nPrevious = els[0],
+ nNext = els[1];
- $(nPrevious).click( function() {
+ oSettings.oApi._fnBindAction( nPrevious, {action: "previous"}, function() {
/* Disallow paging event during a current paging event */
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
{
@@ -69,8 +68,8 @@
};
innerLoop();
} );
-
- $(nNext).click( function() {
+
+ oSettings.oApi._fnBindAction( nNext, {action: "next"}, function() {
/* Disallow paging event during a current paging event */
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
{
@@ -98,10 +97,6 @@
};
innerLoop();
} );
-
- /* Take the brutal approach to cancelling text selection */
- $(nPrevious).bind( 'selectstart', function () { return false; } );
- $(nNext).bind( 'selectstart', function () { return false; } );
},
"fnUpdate": function ( oSettings, fnCallbackDraw )

0 comments on commit 273aab7

Please sign in to comment.