mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Merge pull request #89 from timtucker/patch-6
Use hasChildNodes() rather than childNodes.length
This commit is contained in:
commit
9c82abe79d
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Variable: oPagination
|
||||
* Purpose:
|
||||
@ -73,16 +72,21 @@ $.extend( DataTable.ext.oPagination, {
|
||||
|
||||
var oClasses = oSettings.oClasses;
|
||||
var an = oSettings.aanFeatures.p;
|
||||
var nNode;
|
||||
|
||||
/* Loop over each instance of the pager */
|
||||
for ( var i=0, iLen=an.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( an[i].childNodes.length !== 0 )
|
||||
nNode = an[i].firstChild;
|
||||
if ( nNode )
|
||||
{
|
||||
an[i].childNodes[0].className = ( oSettings._iDisplayStart === 0 ) ?
|
||||
/* Previous page */
|
||||
nNode.className = ( oSettings._iDisplayStart === 0 ) ?
|
||||
oClasses.sPagePrevDisabled : oClasses.sPagePrevEnabled;
|
||||
|
||||
an[i].childNodes[1].className = ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ?
|
||||
/* Next page */
|
||||
nNode = nNode.nextSibling;
|
||||
nNode.className = ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ?
|
||||
oClasses.sPageNextDisabled : oClasses.sPageNextEnabled;
|
||||
}
|
||||
}
|
||||
@ -172,7 +176,7 @@ $.extend( DataTable.ext.oPagination, {
|
||||
var sList = "";
|
||||
var iStartButton, iEndButton, i, iLen;
|
||||
var oClasses = oSettings.oClasses;
|
||||
var anButtons, anStatic, nPaginateList;
|
||||
var anButtons, anStatic, nPaginateList, nNode;
|
||||
var an = oSettings.aanFeatures.p;
|
||||
var fnBind = function (j) {
|
||||
oSettings.oApi._fnBindAction( this, {"page": j+iStartButton-1}, function(e) {
|
||||
@ -223,18 +227,19 @@ $.extend( DataTable.ext.oPagination, {
|
||||
/* Loop over each instance of the pager */
|
||||
for ( i=0, iLen=an.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( an[i].childNodes.length === 0 )
|
||||
nNode = an[i];
|
||||
if ( !nNode.hasChildNodes() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Build up the dynamic list first - html and listeners */
|
||||
$('span:eq(0)', an[i])
|
||||
$('span:eq(0)', nNode)
|
||||
.html( sList )
|
||||
.children('a').each( fnBind );
|
||||
|
||||
/* Update the permanent button's classes */
|
||||
anButtons = an[i].getElementsByTagName('a');
|
||||
anButtons = nNode.getElementsByTagName('a');
|
||||
anStatic = [
|
||||
anButtons[0], anButtons[1],
|
||||
anButtons[anButtons.length-2], anButtons[anButtons.length-1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user