1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

Same thing for two button pagination control

This commit is contained in:
Sahab Yazdani 2011-10-14 15:13:13 -04:00
parent ba02adc6e9
commit 4b1b4626a5

View File

@ -286,6 +286,13 @@
*/
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
{
function fnClickHandler ( e ) {
if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
{
fnCallbackDraw( oSettings );
}
}
var nPrevious, nNext, nPreviousInner, nNextInner;
/* Store the next and previous elements in the oSettings object as they can be very
@ -319,24 +326,12 @@
nPaging.appendChild( nPrevious );
nPaging.appendChild( nNext );
$(nPrevious).bind( 'click.DT', function() {
if ( oSettings.oApi._fnPageChange( oSettings, "previous" ) )
{
/* Only draw when the page has actually changed */
fnCallbackDraw( oSettings );
}
} );
$(nNext).bind( 'click.DT', function() {
if ( oSettings.oApi._fnPageChange( oSettings, "next" ) )
{
fnCallbackDraw( oSettings );
}
} );
/* Take the brutal approach to cancelling text selection */
$(nPrevious).bind( 'selectstart.DT', function () { return false; } );
$(nNext).bind( 'selectstart.DT', function () { return false; } );
$(nPrevious)
.bind( 'click.DT', { action: "previous" }, fnClickHandler )
.bind( 'selectstart.DT', function () { return false; } ); /* Take the brutal approach to cancelling text selection */
$(nNext)
.bind( 'click.DT', { action: "next" }, fnClickHandler )
.bind( 'selectstart.DT', function () { return false; } ); /* Take the brutal approach to cancelling text selection */
/* ID the first elements only */
if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.p == "undefined" )