From 2adba8a7db526864de4d53979e554c7f74c103e9 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 18 Jul 2013 07:55:24 +0100 Subject: [PATCH] Fix - foundation integration: pagining could cause changes to other UL elements on the page. - Thanks to MattSyp for spotting and suggesting the fix for this ( http://datatables.net/forums/discussion/16470 ) --- integration/foundation/dataTables.foundation.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/integration/foundation/dataTables.foundation.js b/integration/foundation/dataTables.foundation.js index b55cb7f..9e00dde 100644 --- a/integration/foundation/dataTables.foundation.js +++ b/integration/foundation/dataTables.foundation.js @@ -56,7 +56,7 @@ $.extend( $.fn.dataTableExt.oPagination, { var oPaging = oSettings.oInstance.fnPagingInfo(); var an = oSettings.aanFeatures.p; var pages = []; - var i, ien, klass; + var i, ien, klass, host; // This could use some improving - however, see // https://github.com/DataTables/DataTables/issues/163 - this will @@ -116,14 +116,15 @@ $.extend( $.fn.dataTableExt.oPagination, { for ( i=0, ien=an.length ; i'+(page===null? '…' : page+1)+'') - .insertBefore( $('li:last', an[i]) ) + .insertBefore( $('li:last', host) ) .bind('click', function (e) { e.preventDefault(); oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; @@ -133,15 +134,15 @@ $.extend( $.fn.dataTableExt.oPagination, { // Add / remove disabled classes from the static elements if ( oPaging.iPage === 0 ) { - $('li:first', an[i]).addClass('unavailable'); + $('li:first', host).addClass('unavailable'); } else { - $('li:first', an[i]).removeClass('unavailable'); + $('li:first', host).removeClass('unavailable'); } if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { - $('li:last', an[i]).addClass('unavailable'); + $('li:last', host).addClass('unavailable'); } else { - $('li:last', an[i]).removeClass('unavailable'); + $('li:last', host).removeClass('unavailable'); } } }