Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/02/2016, 06:52
sentoki79
 
Fecha de Ingreso: octubre-2013
Mensajes: 79
Antigüedad: 10 años, 6 meses
Puntos: 1
Respuesta: Problema funciones DataTables

Tras darme cuenta que podia ser por la estructura de la tabla( Thead, tr, td que coincidan con el ejemplo) tras hacer las modificaciones necesarias, la cosa mejora pero lanza un error: la variable nTd no esta definida en la linea 1770.
No he tocado en ningun momento el archivo de datatables.js que es el que da el error.

Pego el codigo por si encuentran el error(pego todo el codigo que hace referencia a la variable nTd):

function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
{
var
row = oSettings.aoData[iRow],
rowData = row._aData,
cells = [],
nTr, nTd, oCol,
i, iLen;

if ( row.nTr === null )
{
nTr = nTrIn || document.createElement('tr');

row.nTr = nTr;
row.anCells = cells;

/* Use a private property on the node to allow reserve mapping from the node
* to the aoData array for fast look up
*/
nTr._DT_RowIndex = iRow;

/* Special parameters can be given by the data source to be used on the row */
_fnRowAttributes( oSettings, row );

/* Process each column */
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
oCol = oSettings.aoColumns[i];

nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
nTd._DT_CellIndex = {
row: iRow,
column: i
};

cells.push( nTd );

// Need to create the HTML if new, or if a rendering function is defined
if ( (!nTrIn || oCol.mRender || oCol.mData !== i) &&
(!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')
) {
nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
}

/* Add user defined class */
if ( oCol.sClass )
{
nTd.className += ' '+oCol.sClass;
}

// Visibility - add or remove as required
if ( oCol.bVisible && ! nTrIn )
{
nTr.appendChild( nTd );
}
else if ( ! oCol.bVisible && nTrIn )
{
nTd.parentNode.removeChild( nTd );
}

if ( oCol.fnCreatedCell )
{
oCol.fnCreatedCell.call( oSettings.oInstance,
nTd, _fnGetCellData( oSettings, iRow, i ), rowData, iRow, i
);
}
}

_fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] );
}

// Remove once webkit bug 131819 and Chromium bug 365619 have been resolved
// and deployed
row.nTr.setAttribute( 'role', 'row' );
}


Gracias por las ideas para solucionarlo :)