mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-10 22:24:10 +01:00
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
This commit is contained in:
parent
af2e153bc3
commit
273aab7e59
@ -18,29 +18,28 @@ $.fn.dataTableExt.oPagination.iTweenTime = 100;
|
|||||||
$.fn.dataTableExt.oPagination.scrolling = {
|
$.fn.dataTableExt.oPagination.scrolling = {
|
||||||
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
|
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
|
||||||
{
|
{
|
||||||
/* Store the next and previous elements in the oSettings object as they can be very
|
var oLang = oSettings.oLanguage.oPaginate;
|
||||||
* usful for automation - particularly testing
|
var oClasses = oSettings.oClasses;
|
||||||
*/
|
var fnClickHandler = function ( e ) {
|
||||||
var nPrevious = document.createElement( 'div' );
|
if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
|
||||||
var nNext = document.createElement( 'div' );
|
|
||||||
|
|
||||||
if ( oSettings.sTableId !== '' )
|
|
||||||
{
|
{
|
||||||
nPaging.setAttribute( 'id', oSettings.sTableId+'_paginate' );
|
fnCallbackDraw( oSettings );
|
||||||
nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' );
|
|
||||||
nNext.setAttribute( 'id', oSettings.sTableId+'_next' );
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
nPrevious.className = "paginate_disabled_previous";
|
var sAppend = (!oSettings.bJUI) ?
|
||||||
nNext.className = "paginate_disabled_next";
|
'<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 );
|
||||||
|
|
||||||
nPrevious.title = oSettings.oLanguage.oPaginate.sPrevious;
|
var els = $('a', nPaging);
|
||||||
nNext.title = oSettings.oLanguage.oPaginate.sNext;
|
var nPrevious = els[0],
|
||||||
|
nNext = els[1];
|
||||||
|
|
||||||
nPaging.appendChild( nPrevious );
|
oSettings.oApi._fnBindAction( nPrevious, {action: "previous"}, function() {
|
||||||
nPaging.appendChild( nNext );
|
|
||||||
|
|
||||||
$(nPrevious).click( function() {
|
|
||||||
/* Disallow paging event during a current paging event */
|
/* Disallow paging event during a current paging event */
|
||||||
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
|
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
|
||||||
{
|
{
|
||||||
@ -70,7 +69,7 @@ $.fn.dataTableExt.oPagination.scrolling = {
|
|||||||
innerLoop();
|
innerLoop();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$(nNext).click( function() {
|
oSettings.oApi._fnBindAction( nNext, {action: "next"}, function() {
|
||||||
/* Disallow paging event during a current paging event */
|
/* Disallow paging event during a current paging event */
|
||||||
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
|
if ( typeof oSettings.iPagingLoopStart != 'undefined' && oSettings.iPagingLoopStart != -1 )
|
||||||
{
|
{
|
||||||
@ -98,10 +97,6 @@ $.fn.dataTableExt.oPagination.scrolling = {
|
|||||||
};
|
};
|
||||||
innerLoop();
|
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 )
|
"fnUpdate": function ( oSettings, fnCallbackDraw )
|
||||||
|
Loading…
Reference in New Issue
Block a user