mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Update media/src/core/core.constructor.js
Allow for adding / removing an arbitrary number of stripe rows
This commit is contained in:
parent
0d47107906
commit
75ce320838
@ -1,4 +1,3 @@
|
||||
|
||||
var i=0, iLen, j, jLen, k, kLen;
|
||||
var sId = this.getAttribute( 'id' );
|
||||
var bInitHandedOff = false;
|
||||
@ -240,42 +239,29 @@ if ( oInit.asStripeClasses === null )
|
||||
}
|
||||
|
||||
/* Remove row stripe classes if they are already on the table row */
|
||||
var bStripeRemove = false;
|
||||
var anRows = $(this).children('tbody').children('tr');
|
||||
for ( i=0, iLen=oSettings.asStripeClasses.length ; i<iLen ; i++ )
|
||||
iLen=oSettings.asStripeClasses.length;
|
||||
oSettings.asDestroyStripes = [];
|
||||
if (iLen)
|
||||
{
|
||||
if ( anRows.filter(":lt(2)").hasClass( oSettings.asStripeClasses[i]) )
|
||||
var bStripeRemove = false;
|
||||
var anRows = $(this).children('tbody').children('tr:lt(' + iLen + ')');
|
||||
for ( i=0 ; i<iLen ; i++ )
|
||||
{
|
||||
bStripeRemove = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( bStripeRemove )
|
||||
{
|
||||
/* Store the classes which we are about to remove so they can be re-added on destroy */
|
||||
oSettings.asDestroyStripes = [ '', '' ];
|
||||
if ( $(anRows[0]).hasClass(oSettings.oClasses.sStripeOdd) )
|
||||
{
|
||||
oSettings.asDestroyStripes[0] += oSettings.oClasses.sStripeOdd+" ";
|
||||
}
|
||||
if ( $(anRows[0]).hasClass(oSettings.oClasses.sStripeEven) )
|
||||
{
|
||||
oSettings.asDestroyStripes[0] += oSettings.oClasses.sStripeEven;
|
||||
}
|
||||
if ( $(anRows[1]).hasClass(oSettings.oClasses.sStripeOdd) )
|
||||
{
|
||||
oSettings.asDestroyStripes[1] += oSettings.oClasses.sStripeOdd+" ";
|
||||
}
|
||||
if ( $(anRows[1]).hasClass(oSettings.oClasses.sStripeEven) )
|
||||
{
|
||||
oSettings.asDestroyStripes[1] += oSettings.oClasses.sStripeEven;
|
||||
if ( anRows.hasClass( oSettings.asStripeClasses[i] ) )
|
||||
{
|
||||
bStripeRemove = true;
|
||||
|
||||
/* Store the classes which we are about to remove so they can be re-added on destroy */
|
||||
oSettings.asDestroyStripes.push( oSettings.asStripeClasses[i] );
|
||||
}
|
||||
}
|
||||
|
||||
anRows.removeClass( oSettings.asStripeClasses.join(' ') );
|
||||
if ( bStripeRemove )
|
||||
{
|
||||
anRows.removeClass( oSettings.asStripeClasses.join(' ') );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Columns
|
||||
* See if we should load columns automatically or use defined ones
|
||||
|
Loading…
x
Reference in New Issue
Block a user