1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00

Dev: Fix logic check for passing data to the updated _fnCreateTr method

This commit is contained in:
Allan Jardine 2012-10-31 15:39:10 +00:00
parent 5209e2f058
commit 0ff0858734
2 changed files with 16 additions and 16 deletions

View File

@ -996,23 +996,23 @@
* Create a new TR element (and it's TD children) for a row
* @param {object} oSettings dataTables settings object
* @param {int} iRow Row to consider
* @param {node} [nTr] TR element to add to the table - optional. If not given,
* @param {node} [nTrIn] TR element to add to the table - optional. If not given,
* DataTables will create a row automatically
* @param {array} [anTds] Array of TD|TH elements for the row - must be given
* if nTr is.
* @memberof DataTable#oApi
*/
function _fnCreateTr ( oSettings, iRow, nTr, anTds )
function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
{
var
row = oSettings.aoData[iRow],
rowData = row._aData,
nTd, oCol,
nTr, nTd, oCol,
i, iLen;
if ( row.nTr === null )
{
nTr = nTr || document.createElement('tr');
nTr = nTrIn || document.createElement('tr');
/* Use a private property on the node to allow reserve mapping from the node
* to the aoData array for fast look up
@ -1035,10 +1035,10 @@
{
oCol = oSettings.aoColumns[i];
nTd = nTr ? anTds[i] : document.createElement( oCol.sCellType );
nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
// Need to create the HTML if new, or if a rendering function is defined
if ( !nTr || oCol.mRender || oCol.mData !== i )
if ( !nTrIn || oCol.mRender || oCol.mData !== i )
{
nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
}
@ -1051,11 +1051,11 @@
// Visibility - add or remove as required
row._anHidden[i] = oCol.bVisible ? null : nTd;
if ( oCol.bVisible && ! nTr )
if ( oCol.bVisible && ! nTrIn )
{
nTr.appendChild( nTd );
}
else if ( ! oCol.bVisible && nTr )
else if ( ! oCol.bVisible && nTrIn )
{
nTd.parentNode.removeChild( nTd );
}

View File

@ -2,23 +2,23 @@
* Create a new TR element (and it's TD children) for a row
* @param {object} oSettings dataTables settings object
* @param {int} iRow Row to consider
* @param {node} [nTr] TR element to add to the table - optional. If not given,
* @param {node} [nTrIn] TR element to add to the table - optional. If not given,
* DataTables will create a row automatically
* @param {array} [anTds] Array of TD|TH elements for the row - must be given
* if nTr is.
* @memberof DataTable#oApi
*/
function _fnCreateTr ( oSettings, iRow, nTr, anTds )
function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
{
var
row = oSettings.aoData[iRow],
rowData = row._aData,
nTd, oCol,
nTr, nTd, oCol,
i, iLen;
if ( row.nTr === null )
{
nTr = nTr || document.createElement('tr');
nTr = nTrIn || document.createElement('tr');
/* Use a private property on the node to allow reserve mapping from the node
* to the aoData array for fast look up
@ -41,10 +41,10 @@ function _fnCreateTr ( oSettings, iRow, nTr, anTds )
{
oCol = oSettings.aoColumns[i];
nTd = nTr ? anTds[i] : document.createElement( oCol.sCellType );
nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
// Need to create the HTML if new, or if a rendering function is defined
if ( !nTr || oCol.mRender || oCol.mData !== i )
if ( !nTrIn || oCol.mRender || oCol.mData !== i )
{
nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
}
@ -57,11 +57,11 @@ function _fnCreateTr ( oSettings, iRow, nTr, anTds )
// Visibility - add or remove as required
row._anHidden[i] = oCol.bVisible ? null : nTd;
if ( oCol.bVisible && ! nTr )
if ( oCol.bVisible && ! nTrIn )
{
nTr.appendChild( nTd );
}
else if ( ! oCol.bVisible && nTr )
else if ( ! oCol.bVisible && nTrIn )
{
nTd.parentNode.removeChild( nTd );
}