diff --git a/examples/advanced_init/column_render.html b/examples/advanced_init/column_render.html index 81175359..e08c1394 100644 --- a/examples/advanced_init/column_render.html +++ b/examples/advanced_init/column_render.html @@ -16,8 +16,8 @@ $('#example').dataTable( { "aoColumnDefs": [ { - "fnRender": function ( oObj ) { - return oObj.aData[0] +' '+ oObj.aData[3]; + "fnRender": function ( oObj, sVal ) { + return sVal +' '+ oObj.aData[3]; }, "aTargets": [ 0 ] }, @@ -469,8 +469,8 @@ $('#example').dataTable( { "aoColumnDefs": [ { - "fnRender": function ( oObj ) { - return oObj.aData[0] +' '+ oObj.aData[3]; + "fnRender": function ( oObj, sVal ) { + return sVal +' '+ oObj.aData[3]; }, "aTargets": [ 0 ] }, diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 6e53bc12..4d5bc15d 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -463,8 +463,9 @@ "iDataRow": iRow, "iDataColumn": i, "aData": oData._aData, - "oSettings": oSettings - } ) ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, i, 'display') ) ); } /* See if we should auto-detect the column type */ @@ -627,8 +628,9 @@ "iDataRow": iRow, "iDataColumn": iColumn, "aData": oData._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, iColumn, 'display') ); nCell.innerHTML = sRendered; if ( oCol.bUseRendered ) { @@ -1006,8 +1008,9 @@ "iDataRow": iRow, "iDataColumn": i, "aData": oData._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, i, 'display') ); } else { @@ -5798,16 +5801,18 @@ sDisplay = mData; _fnSetCellData( oSettings, iRow, iColumn, sDisplay ); - if ( oSettings.aoColumns[iColumn].fnRender !== null ) + var oCol = oSettings.aoColumns[iColumn]; + if ( oCol.fnRender !== null ) { - sDisplay = oSettings.aoColumns[iColumn].fnRender( { + sDisplay = oCol.fnRender( { "iDataRow": iRow, "iDataColumn": iColumn, "aData": oSettings.aoData[iRow]._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, iColumn, 'display') ); - if ( oSettings.aoColumns[iColumn].bUseRendered ) + if ( oCol.bUseRendered ) { _fnSetCellData( oSettings, iRow, iColumn, sDisplay ); } @@ -9363,6 +9368,8 @@ * @param {int} o.iDataColumn The column in question * @param {array o.aData The data for the row in question * @param {object} o.oSettings The settings object for this DataTables instance + * @param {object} o.mDataProp The data property used for this column + * @param {*} val The current cell value * @returns {string} The string you which to use in the display * * @example @@ -9371,7 +9378,7 @@ * $('#example').dataTable( { * "aoColumnDefs": [ * { - * "fnRender": function ( o ) { + * "fnRender": function ( o, val ) { * return o.aData[0] +' '+ o.aData[3]; * }, * "aTargets": [ 0 ] @@ -9385,7 +9392,7 @@ * $(document).ready(function() { * $('#example').dataTable( { * "aoColumns": [ - * { "fnRender": function ( o ) { + * { "fnRender": function ( o, val ) { * return o.aData[0] +' '+ o.aData[3]; * } }, * null, diff --git a/media/src/api/api.methods.js b/media/src/api/api.methods.js index b28125a2..0828163d 100644 --- a/media/src/api/api.methods.js +++ b/media/src/api/api.methods.js @@ -1082,16 +1082,18 @@ this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction ) sDisplay = mData; _fnSetCellData( oSettings, iRow, iColumn, sDisplay ); - if ( oSettings.aoColumns[iColumn].fnRender !== null ) + var oCol = oSettings.aoColumns[iColumn]; + if ( oCol.fnRender !== null ) { - sDisplay = oSettings.aoColumns[iColumn].fnRender( { + sDisplay = oCol.fnRender( { "iDataRow": iRow, "iDataColumn": iColumn, "aData": oSettings.aoData[iRow]._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, iColumn, 'display') ); - if ( oSettings.aoColumns[iColumn].bUseRendered ) + if ( oCol.bUseRendered ) { _fnSetCellData( oSettings, iRow, iColumn, sDisplay ); } diff --git a/media/src/core/core.data.js b/media/src/core/core.data.js index f81299f9..8d31dc75 100644 --- a/media/src/core/core.data.js +++ b/media/src/core/core.data.js @@ -38,8 +38,9 @@ function _fnAddData ( oSettings, aDataSupplied ) "iDataRow": iRow, "iDataColumn": i, "aData": oData._aData, - "oSettings": oSettings - } ) ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, i, 'display') ) ); } /* See if we should auto-detect the column type */ @@ -202,8 +203,9 @@ function _fnGatherData( oSettings ) "iDataRow": iRow, "iDataColumn": iColumn, "aData": oData._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, iColumn, 'display') ); nCell.innerHTML = sRendered; if ( oCol.bUseRendered ) { diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index e0884b0c..14e4ca0c 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -41,8 +41,9 @@ function _fnCreateTr ( oSettings, iRow ) "iDataRow": iRow, "iDataColumn": i, "aData": oData._aData, - "oSettings": oSettings - } ); + "oSettings": oSettings, + "mDataProp": oCol.mDataProp + }, _fnGetCellData(oSettings, iRow, i, 'display') ); } else { diff --git a/media/src/model/model.defaults.columns.js b/media/src/model/model.defaults.columns.js index 42648492..aee84880 100644 --- a/media/src/model/model.defaults.columns.js +++ b/media/src/model/model.defaults.columns.js @@ -249,6 +249,8 @@ DataTable.defaults.columns = { * @param {int} o.iDataColumn The column in question * @param {array o.aData The data for the row in question * @param {object} o.oSettings The settings object for this DataTables instance + * @param {object} o.mDataProp The data property used for this column + * @param {*} val The current cell value * @returns {string} The string you which to use in the display * * @example @@ -257,7 +259,7 @@ DataTable.defaults.columns = { * $('#example').dataTable( { * "aoColumnDefs": [ * { - * "fnRender": function ( o ) { + * "fnRender": function ( o, val ) { * return o.aData[0] +' '+ o.aData[3]; * }, * "aTargets": [ 0 ] @@ -271,7 +273,7 @@ DataTable.defaults.columns = { * $(document).ready(function() { * $('#example').dataTable( { * "aoColumns": [ - * { "fnRender": function ( o ) { + * { "fnRender": function ( o, val ) { * return o.aData[0] +' '+ o.aData[3]; * } }, * null,