Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions js/core/core.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ function _fnGetCellData( settings, rowIdx, colIdx, type )
else if ( typeof cellData === 'function' ) {
// If the data source is a function, then we run it and use the return,
// executing in the scope of the data object (for instances)
return cellData.call( rowData );
if (col.renderReturnType === 'function') {
return cellData;
} else {
return cellData.call(rowData)
}
}

if ( cellData === null && type === 'display' ) {
Expand Down Expand Up @@ -311,7 +315,13 @@ function _fnInvalidate( settings, rowIdx, src, colIdx )
cell.removeChild( cell.firstChild );
}

cell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' );
var cellData = _fnGetCellData( settings, rowIdx, col, 'display' );
if (typeof cellData === 'string') {
cell.innerHTML = cellData;
} else if (typeof cellData === 'function') {
var targetCol = settings.aoColumns[col]
cellData(cell, targetCol.mData ? row._aData[targetCol.mData] : col.sDefaultContent, row._aData, rowIdx)
}
};

// Are we reading last data from DOM or the data object?
Expand Down
9 changes: 8 additions & 1 deletion js/core/core.draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
if ( create || ((oCol.mRender || oCol.mData !== i) &&
(!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')
)) {
nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );

var cellData = _fnGetCellData( oSettings, iRow, i, 'display' );

if (typeof cellData === 'string') {
nTd.innerHTML = cellData;
} else if (typeof cellData === 'function') {
cellData(nTd, oCol.mData ? row._aData[oCol.mData] : oCol.sDefaultContent, row._aData, iRow)
}
}

/* Add user defined class */
Expand Down