From 82fad5ca5035ff3d671209db4aa0bf79b2afced1 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Fri, 31 Aug 2012 17:37:11 -0300 Subject: [PATCH] Update media/src/api/api.methods.js Allow for adding / removing an arbitrary number of stripe rows --- media/src/api/api.methods.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/media/src/api/api.methods.js b/media/src/api/api.methods.js index 6773873c..063e71f5 100644 --- a/media/src/api/api.methods.js +++ b/media/src/api/api.methods.js @@ -1,5 +1,4 @@ - /** * Perform a jQuery selector action on the table's TR elements (from the tbody) and * return the resulting jQuery object. @@ -566,12 +565,19 @@ this.fnDestroy = function ( bRemove ) oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth); } - /* If the were originally odd/even type classes - then we add them back here. Note - * this is not fool proof (for example if not all rows as odd/even classes - but + /* If the were originally stripe classes - then we add them back here. Note + * this is not fool proof (for example if not all rows had stripe classes - but * it's a good effort without getting carried away */ - $(nBody).children('tr:even').addClass( oSettings.asDestroyStripes[0] ); - $(nBody).children('tr:odd').addClass( oSettings.asDestroyStripes[1] ); + iLen = oSettings.asDestroyStripes.length; + if (iLen) + { + var anRows = $(nBody).children('tr'); + for ( i=0 ; i