Update fnAddTr.js - Fix - Showing invisible columns

Showing not visible columns and returning the result of fnAddData, also fixes the problem described at https://github.com/DataTables/Plugins/pull/24
pull/26/head
globalinnovation 12 years ago
parent 2adba8a7db
commit 404f049976

@ -23,11 +23,21 @@ $.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
} }
var aData = []; var aData = [];
var aInvisible = [];
for ( var i=0 ; i<nTds.length ; i++ ) for ( var i=0 ; i<nTds.length ; i++ )
{ {
aData.push( nTds[i].innerHTML ); aData.push( nTds[i].innerHTML );
if (!oSettings.aoColumns[i].bVisible)
{
aInvisible.push( i );
}
} }
for ( var i = (aInvisible.length - 1) ; i >= 0 ; i-- )
{
nTds[aInvisible[i]].remove();
}
/* Add the data and then replace DataTable's generated TR with ours */ /* Add the data and then replace DataTable's generated TR with ours */
var iIndex = this.oApi._fnAddData( oSettings, aData ); var iIndex = this.oApi._fnAddData( oSettings, aData );
nTr._DT_RowIndex = iIndex; nTr._DT_RowIndex = iIndex;

Loading…
Cancel
Save