mirror of
https://github.com/DataTables/DataTables.git
synced 2025-04-11 03:02:30 +02:00
Updated: Renaming mDataProp to mData for naming consistency and to show its flexibility. Please note that this is a backwards compatible change! DataTables will automatically check for mDataProp on a column and use that if required (if both mData and mDataProp are given then the new mData is used in preference).
This commit is contained in:
parent
4886322183
commit
d155f7a7e7
131
media/js/jquery.dataTables.js
vendored
131
media/js/jquery.dataTables.js
vendored
@ -76,7 +76,7 @@
|
|||||||
"nTh": nTh ? nTh : document.createElement('th'),
|
"nTh": nTh ? nTh : document.createElement('th'),
|
||||||
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
|
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
|
||||||
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
|
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
|
||||||
"mDataProp": oDefaults.mDataProp ? oDefaults.oDefaults : iCol
|
"mData": oDefaults.mData ? oDefaults.oDefaults : iCol
|
||||||
} );
|
} );
|
||||||
oSettings.aoColumns.push( oCol );
|
oSettings.aoColumns.push( oCol );
|
||||||
|
|
||||||
@ -115,7 +115,7 @@
|
|||||||
* Apply options for a column
|
* Apply options for a column
|
||||||
* @param {object} oSettings dataTables settings object
|
* @param {object} oSettings dataTables settings object
|
||||||
* @param {int} iCol column index to consider
|
* @param {int} iCol column index to consider
|
||||||
* @param {object} oOptions object with sType, bVisible and bSearchable
|
* @param {object} oOptions object with sType, bVisible and bSearchable etc
|
||||||
* @memberof DataTable#oApi
|
* @memberof DataTable#oApi
|
||||||
*/
|
*/
|
||||||
function _fnColumnOptions( oSettings, iCol, oOptions )
|
function _fnColumnOptions( oSettings, iCol, oOptions )
|
||||||
@ -125,6 +125,12 @@
|
|||||||
/* User specified column options */
|
/* User specified column options */
|
||||||
if ( oOptions !== undefined && oOptions !== null )
|
if ( oOptions !== undefined && oOptions !== null )
|
||||||
{
|
{
|
||||||
|
/* Backwards compatibility for mDataProp */
|
||||||
|
if ( oOptions.mDataProp && !oOptions.mData )
|
||||||
|
{
|
||||||
|
oOptions.mData = oOptions.mDataProp;
|
||||||
|
}
|
||||||
|
|
||||||
if ( oOptions.sType !== undefined )
|
if ( oOptions.sType !== undefined )
|
||||||
{
|
{
|
||||||
oCol.sType = oOptions.sType;
|
oCol.sType = oOptions.sType;
|
||||||
@ -146,7 +152,7 @@
|
|||||||
|
|
||||||
/* Cache the data get and set functions for speed */
|
/* Cache the data get and set functions for speed */
|
||||||
var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
|
var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
|
||||||
var mData = _fnGetObjectDataFn( oCol.mDataProp );
|
var mData = _fnGetObjectDataFn( oCol.mData );
|
||||||
|
|
||||||
oCol.fnGetData = function (oData, sSpecific) {
|
oCol.fnGetData = function (oData, sSpecific) {
|
||||||
var innerData = mData( oData, sSpecific );
|
var innerData = mData( oData, sSpecific );
|
||||||
@ -157,7 +163,7 @@
|
|||||||
}
|
}
|
||||||
return innerData;
|
return innerData;
|
||||||
};
|
};
|
||||||
oCol.fnSetData = _fnSetObjectDataFn( oCol.mDataProp );
|
oCol.fnSetData = _fnSetObjectDataFn( oCol.mData );
|
||||||
|
|
||||||
/* Feature sorting overrides column specific when off */
|
/* Feature sorting overrides column specific when off */
|
||||||
if ( !oSettings.oFeatures.bSort )
|
if ( !oSettings.oFeatures.bSort )
|
||||||
@ -467,7 +473,7 @@
|
|||||||
oCol = oSettings.aoColumns[i];
|
oCol = oSettings.aoColumns[i];
|
||||||
|
|
||||||
/* Use rendered data for filtering/sorting */
|
/* Use rendered data for filtering/sorting */
|
||||||
if ( typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mDataProp !== null )
|
if ( typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mData !== null )
|
||||||
{
|
{
|
||||||
_fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) );
|
_fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) );
|
||||||
}
|
}
|
||||||
@ -622,7 +628,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof oCol.mDataProp === 'function' )
|
if ( typeof oCol.mData === 'function' )
|
||||||
{
|
{
|
||||||
nCell.innerHTML = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
|
nCell.innerHTML = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
|
||||||
}
|
}
|
||||||
@ -753,7 +759,7 @@
|
|||||||
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
|
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
|
||||||
{
|
{
|
||||||
_fnLog( oSettings, 0, "Requested unknown parameter "+
|
_fnLog( oSettings, 0, "Requested unknown parameter "+
|
||||||
(typeof oCol.mDataProp=='function' ? '{mDataprop function}' : "'"+oCol.mDataProp+"'")+
|
(typeof oCol.mData=='function' ? '{mData function}' : "'"+oCol.mData+"'")+
|
||||||
" from the data source for row "+iRow );
|
" from the data source for row "+iRow );
|
||||||
oSettings.iDrawError = oSettings.iDraw;
|
oSettings.iDrawError = oSettings.iDraw;
|
||||||
}
|
}
|
||||||
@ -1056,7 +1062,7 @@
|
|||||||
"iDataColumn": iCol,
|
"iDataColumn": iCol,
|
||||||
"oSettings": oSettings,
|
"oSettings": oSettings,
|
||||||
"aData": oSettings.aoData[iRow]._aData,
|
"aData": oSettings.aoData[iRow]._aData,
|
||||||
"mDataProp": oCol.mDataProp
|
"mDataProp": oCol.mData
|
||||||
}, _fnGetCellData(oSettings, iRow, iCol, 'display') );
|
}, _fnGetCellData(oSettings, iRow, iCol, 'display') );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,7 +1106,7 @@
|
|||||||
/* Render if needed - if bUseRendered is true then we already have the rendered
|
/* Render if needed - if bUseRendered is true then we already have the rendered
|
||||||
* value in the data source - so can just use that
|
* value in the data source - so can just use that
|
||||||
*/
|
*/
|
||||||
nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mDataProp === null)) ?
|
nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mData === null)) ?
|
||||||
_fnRender( oSettings, iRow, i ) :
|
_fnRender( oSettings, iRow, i ) :
|
||||||
_fnGetCellData( oSettings, iRow, i, 'display' );
|
_fnGetCellData( oSettings, iRow, i, 'display' );
|
||||||
|
|
||||||
@ -1899,7 +1905,7 @@
|
|||||||
|
|
||||||
for ( i=0 ; i<iColumns ; i++ )
|
for ( i=0 ; i<iColumns ; i++ )
|
||||||
{
|
{
|
||||||
mDataProp = oSettings.aoColumns[i].mDataProp;
|
mDataProp = oSettings.aoColumns[i].mData;
|
||||||
aoData.push( { "name": "mDataProp_"+i, "value": typeof(mDataProp)==="function" ? 'function' : mDataProp } );
|
aoData.push( { "name": "mDataProp_"+i, "value": typeof(mDataProp)==="function" ? 'function' : mDataProp } );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5096,8 +5102,8 @@
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>1D array of data - add a single row with the data provided</li>
|
* <li>1D array of data - add a single row with the data provided</li>
|
||||||
* <li>2D array of arrays - add multiple rows in a single call</li>
|
* <li>2D array of arrays - add multiple rows in a single call</li>
|
||||||
* <li>object - data object when using <i>mDataProp</i></li>
|
* <li>object - data object when using <i>mData</i></li>
|
||||||
* <li>array of objects - multiple data objects when using <i>mDataProp</i></li>
|
* <li>array of objects - multiple data objects when using <i>mData</i></li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param {bool} [bRedraw=true] redraw the table or not
|
* @param {bool} [bRedraw=true] redraw the table or not
|
||||||
* @returns {array} An array of integers, representing the list of indexes in
|
* @returns {array} An array of integers, representing the list of indexes in
|
||||||
@ -6967,8 +6973,8 @@
|
|||||||
* </il>
|
* </il>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Note that as of v1.9, it is typically preferable to use <i>mDataProp</i> to prepare data for
|
* Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
|
||||||
* the different uses that DataTables can put the data to. Specifically <i>mDataProp</i> when
|
* the different uses that DataTables can put the data to. Specifically <i>mData</i> when
|
||||||
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
||||||
* prepare the data as required for the different types. As such, this method is deprecated.
|
* prepare the data as required for the different types. As such, this method is deprecated.
|
||||||
* @type array
|
* @type array
|
||||||
@ -7133,8 +7139,8 @@
|
|||||||
* </il>
|
* </il>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Note that as of v1.9, it is typically preferable to use <i>mDataProp</i> to prepare data for
|
* Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
|
||||||
* the different uses that DataTables can put the data to. Specifically <i>mDataProp</i> when
|
* the different uses that DataTables can put the data to. Specifically <i>mData</i> when
|
||||||
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
||||||
* prepare the data as required for the different types. As such, this method is deprecated.
|
* prepare the data as required for the different types. As such, this method is deprecated.
|
||||||
* @type object
|
* @type object
|
||||||
@ -7461,7 +7467,7 @@
|
|||||||
/**
|
/**
|
||||||
* Data object from the original data source for the row. This is either
|
* Data object from the original data source for the row. This is either
|
||||||
* an array if using the traditional form of DataTables, or an object if
|
* an array if using the traditional form of DataTables, or an object if
|
||||||
* using mDataProp options. The exact type will depend on the passed in
|
* using mData options. The exact type will depend on the passed in
|
||||||
* data from the data source, or will be an array if using DOM a data
|
* data from the data source, or will be an array if using DOM a data
|
||||||
* source.
|
* source.
|
||||||
* @type array|object
|
* @type array|object
|
||||||
@ -7560,7 +7566,7 @@
|
|||||||
* and filtering use the rendered value (true - default), or you can have
|
* and filtering use the rendered value (true - default), or you can have
|
||||||
* the sorting and filtering us the original value (false).
|
* the sorting and filtering us the original value (false).
|
||||||
*
|
*
|
||||||
* *NOTE* It is it is advisable now to use mDataProp as a function and make
|
* *NOTE* It is it is advisable now to use mData as a function and make
|
||||||
* use of the 'type' that it gives, allowing (potentially) different data to
|
* use of the 'type' that it gives, allowing (potentially) different data to
|
||||||
* be used for sorting, filtering, display and type detection.
|
* be used for sorting, filtering, display and type detection.
|
||||||
* @type boolean
|
* @type boolean
|
||||||
@ -7600,7 +7606,7 @@
|
|||||||
/**
|
/**
|
||||||
* Function to get data from a cell in a column. You should <b>never</b>
|
* Function to get data from a cell in a column. You should <b>never</b>
|
||||||
* access data directly through _aData internally in DataTables - always use
|
* access data directly through _aData internally in DataTables - always use
|
||||||
* the method attached to this property. It allows mDataProp to function as
|
* the method attached to this property. It allows mData to function as
|
||||||
* required. This function is automatically assigned by the column
|
* required. This function is automatically assigned by the column
|
||||||
* initialisation method
|
* initialisation method
|
||||||
* @type function
|
* @type function
|
||||||
@ -7630,7 +7636,7 @@
|
|||||||
/**
|
/**
|
||||||
* Function to set data for a cell in the column. You should <b>never</b>
|
* Function to set data for a cell in the column. You should <b>never</b>
|
||||||
* set the data directly to _aData internally in DataTables - always use
|
* set the data directly to _aData internally in DataTables - always use
|
||||||
* this method. It allows mDataProp to function as required. This function
|
* this method. It allows mData to function as required. This function
|
||||||
* is automatically assigned by the column initialisation method
|
* is automatically assigned by the column initialisation method
|
||||||
* @type function
|
* @type function
|
||||||
* @param {array|object} oData The data array/object for the array
|
* @param {array|object} oData The data array/object for the array
|
||||||
@ -7647,13 +7653,13 @@
|
|||||||
* @type function|int|string|null
|
* @type function|int|string|null
|
||||||
* @default null
|
* @default null
|
||||||
*/
|
*/
|
||||||
"mDataProp": null,
|
"mData": null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Partner property to mDataProp which is used (only when defined) to get
|
* Partner property to mData which is used (only when defined) to get
|
||||||
* the data - i.e. it is basically the same as mDataProp, but without the
|
* the data - i.e. it is basically the same as mData, but without the
|
||||||
* 'set' option, and also the data fed to it is the result from mDataProp.
|
* 'set' option, and also the data fed to it is the result from mData.
|
||||||
* This is the rendering method to match the data method of mDataProp.
|
* This is the rendering method to match the data method of mData.
|
||||||
* @type function|int|string|null
|
* @type function|int|string|null
|
||||||
* @default null
|
* @default null
|
||||||
*/
|
*/
|
||||||
@ -7698,7 +7704,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a default value to be given for a column's data, and will be used
|
* Allows a default value to be given for a column's data, and will be used
|
||||||
* whenever a null data source is encountered (this can be because mDataProp
|
* whenever a null data source is encountered (this can be because mData
|
||||||
* is set to null, or because the data source itself is null).
|
* is set to null, or because the data source itself is null).
|
||||||
* @type string
|
* @type string
|
||||||
* @default null
|
* @default null
|
||||||
@ -7799,7 +7805,7 @@
|
|||||||
* } );
|
* } );
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Using an array of objects as a data source (mDataProp)
|
* // Using an array of objects as a data source (mData)
|
||||||
* $(document).ready( function () {
|
* $(document).ready( function () {
|
||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "aaData": [
|
* "aaData": [
|
||||||
@ -7819,11 +7825,11 @@
|
|||||||
* }
|
* }
|
||||||
* ],
|
* ],
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "sTitle": "Engine", "mDataProp": "engine" },
|
* { "sTitle": "Engine", "mData": "engine" },
|
||||||
* { "sTitle": "Browser", "mDataProp": "browser" },
|
* { "sTitle": "Browser", "mData": "browser" },
|
||||||
* { "sTitle": "Platform", "mDataProp": "platform" },
|
* { "sTitle": "Platform", "mData": "platform" },
|
||||||
* { "sTitle": "Version", "mDataProp": "version" },
|
* { "sTitle": "Version", "mData": "version" },
|
||||||
* { "sTitle": "Grade", "mDataProp": "grade" }
|
* { "sTitle": "Grade", "mData": "grade" }
|
||||||
* ]
|
* ]
|
||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
@ -9856,7 +9862,7 @@
|
|||||||
* rendered data that the user can see). This may be useful for dates etc.
|
* rendered data that the user can see). This may be useful for dates etc.
|
||||||
*
|
*
|
||||||
* *NOTE* This property is now deprecated, and it is suggested that you use
|
* *NOTE* This property is now deprecated, and it is suggested that you use
|
||||||
* mDataProp and / or mRender to render data for the DataTable.
|
* mData and / or mRender to render data for the DataTable.
|
||||||
* @type boolean
|
* @type boolean
|
||||||
* @default true
|
* @default true
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
@ -10044,9 +10050,18 @@
|
|||||||
"iDataSort": -1,
|
"iDataSort": -1,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This parameter has been replaced by mData in DataTables to ensure naming
|
||||||
|
* consistency. mDataProp can still be used, as there is backwards compatibility
|
||||||
|
* in DataTables for this option, but it is strongly recommended that you use
|
||||||
|
* mData in preference to mDataProp.
|
||||||
|
* @name DataTable.defaults.columns.mDataProp
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property can be used to read data from any JSON data source property,
|
* This property can be used to read data from any JSON data source property,
|
||||||
* including deeply nested objects / properties. mDataProp can be given in a
|
* including deeply nested objects / properties. mData can be given in a
|
||||||
* number of different ways which effect its behaviour:
|
* number of different ways which effect its behaviour:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>integer - treated as an array index for the data source. This is the
|
* <li>integer - treated as an array index for the data source. This is the
|
||||||
@ -10073,6 +10088,11 @@
|
|||||||
* of call, but otherwise the return is what will be used for the data
|
* of call, but otherwise the return is what will be used for the data
|
||||||
* requested.</li>
|
* requested.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
|
* Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change
|
||||||
|
* reflects the flexibility of this property and is consistent with the naming of
|
||||||
|
* mRender. If 'mDataProp' is given, then it will still be used by DataTables, as
|
||||||
|
* it automatically maps the old name to the new if required.
|
||||||
* @type string|int|function|null
|
* @type string|int|function|null
|
||||||
* @default null <i>Use automatically calculated column index</i>
|
* @default null <i>Use automatically calculated column index</i>
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
@ -10083,24 +10103,24 @@
|
|||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "sAjaxSource": "sources/deep.txt",
|
* "sAjaxSource": "sources/deep.txt",
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "mDataProp": "engine" },
|
* { "mData": "engine" },
|
||||||
* { "mDataProp": "browser" },
|
* { "mData": "browser" },
|
||||||
* { "mDataProp": "platform.inner" },
|
* { "mData": "platform.inner" },
|
||||||
* { "mDataProp": "platform.details.0" },
|
* { "mData": "platform.details.0" },
|
||||||
* { "mDataProp": "platform.details.1" }
|
* { "mData": "platform.details.1" }
|
||||||
* ]
|
* ]
|
||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Using mDataProp as a function to provide different information for
|
* // Using mData as a function to provide different information for
|
||||||
* // sorting, filtering and display. In this case, currency (price)
|
* // sorting, filtering and display. In this case, currency (price)
|
||||||
* $(document).ready(function() {
|
* $(document).ready(function() {
|
||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "aTargets": [ 0 ],
|
* "aTargets": [ 0 ],
|
||||||
* "mDataProp": function ( source, type, val ) {
|
* "mData": function ( source, type, val ) {
|
||||||
* if (type === 'set') {
|
* if (type === 'set') {
|
||||||
* source.price = val;
|
* source.price = val;
|
||||||
* // Store the computed dislay and filter values for efficiency
|
* // Store the computed dislay and filter values for efficiency
|
||||||
@ -10121,16 +10141,15 @@
|
|||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
*/
|
*/
|
||||||
"mDataProp": null,
|
"mData": null,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property is the rendering partner to mDataProp and it is suggested that
|
* This property is the rendering partner to mData and it is suggested that
|
||||||
* when you want to manipulate data for display (including filtering, sorting etc)
|
* when you want to manipulate data for display (including filtering, sorting etc)
|
||||||
* but not altering the underlying data for the table, use this property. mDataProp
|
* but not altering the underlying data for the table, use this property. mData
|
||||||
* can actually do everything this property can and more, but this parameter is
|
* can actually do everything this property can and more, but this parameter is
|
||||||
* easier to use since there is no 'set' option. Like mDataProp is can be given
|
* easier to use since there is no 'set' option. Like mData is can be given
|
||||||
* in a number of different ways to effect its behaviour, with the addition of
|
* in a number of different ways to effect its behaviour, with the addition of
|
||||||
* supporting array syntax for easy outputting of arrays (including arrays of
|
* supporting array syntax for easy outputting of arrays (including arrays of
|
||||||
* objects):
|
* objects):
|
||||||
@ -10148,16 +10167,16 @@
|
|||||||
* needs to set or get the data for a cell in the column. The function
|
* needs to set or get the data for a cell in the column. The function
|
||||||
* takes three parameters:
|
* takes three parameters:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{array|object} The data source for the row (based on mDataProp)</li>
|
* <li>{array|object} The data source for the row (based on mData)</li>
|
||||||
* <li>{string} The type call data requested - this will be 'filter', 'display',
|
* <li>{string} The type call data requested - this will be 'filter', 'display',
|
||||||
* 'type' or 'sort'.</li>
|
* 'type' or 'sort'.</li>
|
||||||
* <li>{array|object} The full data source for the row (not based on mDataProp)</li>
|
* <li>{array|object} The full data source for the row (not based on mData)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* The return value from the function is what will be used for the data
|
* The return value from the function is what will be used for the data
|
||||||
* requested.</li>
|
* requested.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @type string|int|function|null
|
* @type string|int|function|null
|
||||||
* @default null <i>Use mDataProp</i>
|
* @default null <i>Use mData</i>
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
@ -10166,10 +10185,10 @@
|
|||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "sAjaxSource": "sources/deep.txt",
|
* "sAjaxSource": "sources/deep.txt",
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "mDataProp": "engine" },
|
* { "mData": "engine" },
|
||||||
* { "mDataProp": "browser" },
|
* { "mData": "browser" },
|
||||||
* {
|
* {
|
||||||
* "mDataProp": "platform",
|
* "mData": "platform",
|
||||||
* "mRender": "[, ].name"
|
* "mRender": "[, ].name"
|
||||||
* }
|
* }
|
||||||
* ]
|
* ]
|
||||||
@ -10183,7 +10202,7 @@
|
|||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "aTargets": [ 0 ],
|
* "aTargets": [ 0 ],
|
||||||
* "mDataProp": "download_link",
|
* "mData": "download_link",
|
||||||
* "mRender": function ( data, type, full ) {
|
* "mRender": function ( data, type, full ) {
|
||||||
* return '<a href="'+data+'">Download</a>';
|
* return '<a href="'+data+'">Download</a>';
|
||||||
* }
|
* }
|
||||||
@ -10284,7 +10303,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a default value to be given for a column's data, and will be used
|
* Allows a default value to be given for a column's data, and will be used
|
||||||
* whenever a null data source is encountered (this can be because mDataProp
|
* whenever a null data source is encountered (this can be because mData
|
||||||
* is set to null, or because the data source itself is null).
|
* is set to null, or because the data source itself is null).
|
||||||
* @type string
|
* @type string
|
||||||
* @default null
|
* @default null
|
||||||
@ -10296,7 +10315,7 @@
|
|||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "mDataProp": null,
|
* "mData": null,
|
||||||
* "sDefaultContent": "Edit",
|
* "sDefaultContent": "Edit",
|
||||||
* "aTargets": [ -1 ]
|
* "aTargets": [ -1 ]
|
||||||
* }
|
* }
|
||||||
@ -10313,7 +10332,7 @@
|
|||||||
* null,
|
* null,
|
||||||
* null,
|
* null,
|
||||||
* {
|
* {
|
||||||
* "mDataProp": null,
|
* "mData": null,
|
||||||
* "sDefaultContent": "Edit"
|
* "sDefaultContent": "Edit"
|
||||||
* }
|
* }
|
||||||
* ]
|
* ]
|
||||||
|
@ -199,8 +199,8 @@ this._ = function ( sSelector, oOpts )
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>1D array of data - add a single row with the data provided</li>
|
* <li>1D array of data - add a single row with the data provided</li>
|
||||||
* <li>2D array of arrays - add multiple rows in a single call</li>
|
* <li>2D array of arrays - add multiple rows in a single call</li>
|
||||||
* <li>object - data object when using <i>mDataProp</i></li>
|
* <li>object - data object when using <i>mData</i></li>
|
||||||
* <li>array of objects - multiple data objects when using <i>mDataProp</i></li>
|
* <li>array of objects - multiple data objects when using <i>mData</i></li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param {bool} [bRedraw=true] redraw the table or not
|
* @param {bool} [bRedraw=true] redraw the table or not
|
||||||
* @returns {array} An array of integers, representing the list of indexes in
|
* @returns {array} An array of integers, representing the list of indexes in
|
||||||
|
@ -50,7 +50,7 @@ function _fnAjaxParameters( oSettings )
|
|||||||
|
|
||||||
for ( i=0 ; i<iColumns ; i++ )
|
for ( i=0 ; i<iColumns ; i++ )
|
||||||
{
|
{
|
||||||
mDataProp = oSettings.aoColumns[i].mDataProp;
|
mDataProp = oSettings.aoColumns[i].mData;
|
||||||
aoData.push( { "name": "mDataProp_"+i, "value": typeof(mDataProp)==="function" ? 'function' : mDataProp } );
|
aoData.push( { "name": "mDataProp_"+i, "value": typeof(mDataProp)==="function" ? 'function' : mDataProp } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ function _fnAddColumn( oSettings, nTh )
|
|||||||
"nTh": nTh ? nTh : document.createElement('th'),
|
"nTh": nTh ? nTh : document.createElement('th'),
|
||||||
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
|
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
|
||||||
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
|
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
|
||||||
"mDataProp": oDefaults.mDataProp ? oDefaults.oDefaults : iCol
|
"mData": oDefaults.mData ? oDefaults.oDefaults : iCol
|
||||||
} );
|
} );
|
||||||
oSettings.aoColumns.push( oCol );
|
oSettings.aoColumns.push( oCol );
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ function _fnAddColumn( oSettings, nTh )
|
|||||||
* Apply options for a column
|
* Apply options for a column
|
||||||
* @param {object} oSettings dataTables settings object
|
* @param {object} oSettings dataTables settings object
|
||||||
* @param {int} iCol column index to consider
|
* @param {int} iCol column index to consider
|
||||||
* @param {object} oOptions object with sType, bVisible and bSearchable
|
* @param {object} oOptions object with sType, bVisible and bSearchable etc
|
||||||
* @memberof DataTable#oApi
|
* @memberof DataTable#oApi
|
||||||
*/
|
*/
|
||||||
function _fnColumnOptions( oSettings, iCol, oOptions )
|
function _fnColumnOptions( oSettings, iCol, oOptions )
|
||||||
@ -65,6 +65,12 @@ function _fnColumnOptions( oSettings, iCol, oOptions )
|
|||||||
/* User specified column options */
|
/* User specified column options */
|
||||||
if ( oOptions !== undefined && oOptions !== null )
|
if ( oOptions !== undefined && oOptions !== null )
|
||||||
{
|
{
|
||||||
|
/* Backwards compatibility for mDataProp */
|
||||||
|
if ( oOptions.mDataProp && !oOptions.mData )
|
||||||
|
{
|
||||||
|
oOptions.mData = oOptions.mDataProp;
|
||||||
|
}
|
||||||
|
|
||||||
if ( oOptions.sType !== undefined )
|
if ( oOptions.sType !== undefined )
|
||||||
{
|
{
|
||||||
oCol.sType = oOptions.sType;
|
oCol.sType = oOptions.sType;
|
||||||
@ -86,7 +92,7 @@ function _fnColumnOptions( oSettings, iCol, oOptions )
|
|||||||
|
|
||||||
/* Cache the data get and set functions for speed */
|
/* Cache the data get and set functions for speed */
|
||||||
var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
|
var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
|
||||||
var mData = _fnGetObjectDataFn( oCol.mDataProp );
|
var mData = _fnGetObjectDataFn( oCol.mData );
|
||||||
|
|
||||||
oCol.fnGetData = function (oData, sSpecific) {
|
oCol.fnGetData = function (oData, sSpecific) {
|
||||||
var innerData = mData( oData, sSpecific );
|
var innerData = mData( oData, sSpecific );
|
||||||
@ -97,7 +103,7 @@ function _fnColumnOptions( oSettings, iCol, oOptions )
|
|||||||
}
|
}
|
||||||
return innerData;
|
return innerData;
|
||||||
};
|
};
|
||||||
oCol.fnSetData = _fnSetObjectDataFn( oCol.mDataProp );
|
oCol.fnSetData = _fnSetObjectDataFn( oCol.mData );
|
||||||
|
|
||||||
/* Feature sorting overrides column specific when off */
|
/* Feature sorting overrides column specific when off */
|
||||||
if ( !oSettings.oFeatures.bSort )
|
if ( !oSettings.oFeatures.bSort )
|
||||||
|
@ -31,7 +31,7 @@ function _fnAddData ( oSettings, aDataSupplied )
|
|||||||
oCol = oSettings.aoColumns[i];
|
oCol = oSettings.aoColumns[i];
|
||||||
|
|
||||||
/* Use rendered data for filtering/sorting */
|
/* Use rendered data for filtering/sorting */
|
||||||
if ( typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mDataProp !== null )
|
if ( typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mData !== null )
|
||||||
{
|
{
|
||||||
_fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) );
|
_fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) );
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ function _fnGatherData( oSettings )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof oCol.mDataProp === 'function' )
|
if ( typeof oCol.mData === 'function' )
|
||||||
{
|
{
|
||||||
nCell.innerHTML = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
|
nCell.innerHTML = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
|
|||||||
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
|
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
|
||||||
{
|
{
|
||||||
_fnLog( oSettings, 0, "Requested unknown parameter "+
|
_fnLog( oSettings, 0, "Requested unknown parameter "+
|
||||||
(typeof oCol.mDataProp=='function' ? '{mDataprop function}' : "'"+oCol.mDataProp+"'")+
|
(typeof oCol.mData=='function' ? '{mData function}' : "'"+oCol.mData+"'")+
|
||||||
" from the data source for row "+iRow );
|
" from the data source for row "+iRow );
|
||||||
oSettings.iDrawError = oSettings.iDraw;
|
oSettings.iDrawError = oSettings.iDraw;
|
||||||
}
|
}
|
||||||
@ -620,6 +620,6 @@ function _fnRender( oSettings, iRow, iCol )
|
|||||||
"iDataColumn": iCol,
|
"iDataColumn": iCol,
|
||||||
"oSettings": oSettings,
|
"oSettings": oSettings,
|
||||||
"aData": oSettings.aoData[iRow]._aData,
|
"aData": oSettings.aoData[iRow]._aData,
|
||||||
"mDataProp": oCol.mDataProp
|
"mDataProp": oCol.mData
|
||||||
}, _fnGetCellData(oSettings, iRow, iCol, 'display') );
|
}, _fnGetCellData(oSettings, iRow, iCol, 'display') );
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ function _fnCreateTr ( oSettings, iRow )
|
|||||||
/* Render if needed - if bUseRendered is true then we already have the rendered
|
/* Render if needed - if bUseRendered is true then we already have the rendered
|
||||||
* value in the data source - so can just use that
|
* value in the data source - so can just use that
|
||||||
*/
|
*/
|
||||||
nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mDataProp === null)) ?
|
nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mData === null)) ?
|
||||||
_fnRender( oSettings, iRow, i ) :
|
_fnRender( oSettings, iRow, i ) :
|
||||||
_fnGetCellData( oSettings, iRow, i, 'display' );
|
_fnGetCellData( oSettings, iRow, i, 'display' );
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ DataTable.models.oColumn = {
|
|||||||
* and filtering use the rendered value (true - default), or you can have
|
* and filtering use the rendered value (true - default), or you can have
|
||||||
* the sorting and filtering us the original value (false).
|
* the sorting and filtering us the original value (false).
|
||||||
*
|
*
|
||||||
* *NOTE* It is it is advisable now to use mDataProp as a function and make
|
* *NOTE* It is it is advisable now to use mData as a function and make
|
||||||
* use of the 'type' that it gives, allowing (potentially) different data to
|
* use of the 'type' that it gives, allowing (potentially) different data to
|
||||||
* be used for sorting, filtering, display and type detection.
|
* be used for sorting, filtering, display and type detection.
|
||||||
* @type boolean
|
* @type boolean
|
||||||
@ -93,7 +93,7 @@ DataTable.models.oColumn = {
|
|||||||
/**
|
/**
|
||||||
* Function to get data from a cell in a column. You should <b>never</b>
|
* Function to get data from a cell in a column. You should <b>never</b>
|
||||||
* access data directly through _aData internally in DataTables - always use
|
* access data directly through _aData internally in DataTables - always use
|
||||||
* the method attached to this property. It allows mDataProp to function as
|
* the method attached to this property. It allows mData to function as
|
||||||
* required. This function is automatically assigned by the column
|
* required. This function is automatically assigned by the column
|
||||||
* initialisation method
|
* initialisation method
|
||||||
* @type function
|
* @type function
|
||||||
@ -123,7 +123,7 @@ DataTable.models.oColumn = {
|
|||||||
/**
|
/**
|
||||||
* Function to set data for a cell in the column. You should <b>never</b>
|
* Function to set data for a cell in the column. You should <b>never</b>
|
||||||
* set the data directly to _aData internally in DataTables - always use
|
* set the data directly to _aData internally in DataTables - always use
|
||||||
* this method. It allows mDataProp to function as required. This function
|
* this method. It allows mData to function as required. This function
|
||||||
* is automatically assigned by the column initialisation method
|
* is automatically assigned by the column initialisation method
|
||||||
* @type function
|
* @type function
|
||||||
* @param {array|object} oData The data array/object for the array
|
* @param {array|object} oData The data array/object for the array
|
||||||
@ -140,13 +140,13 @@ DataTable.models.oColumn = {
|
|||||||
* @type function|int|string|null
|
* @type function|int|string|null
|
||||||
* @default null
|
* @default null
|
||||||
*/
|
*/
|
||||||
"mDataProp": null,
|
"mData": null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Partner property to mDataProp which is used (only when defined) to get
|
* Partner property to mData which is used (only when defined) to get
|
||||||
* the data - i.e. it is basically the same as mDataProp, but without the
|
* the data - i.e. it is basically the same as mData, but without the
|
||||||
* 'set' option, and also the data fed to it is the result from mDataProp.
|
* 'set' option, and also the data fed to it is the result from mData.
|
||||||
* This is the rendering method to match the data method of mDataProp.
|
* This is the rendering method to match the data method of mData.
|
||||||
* @type function|int|string|null
|
* @type function|int|string|null
|
||||||
* @default null
|
* @default null
|
||||||
*/
|
*/
|
||||||
@ -191,7 +191,7 @@ DataTable.models.oColumn = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a default value to be given for a column's data, and will be used
|
* Allows a default value to be given for a column's data, and will be used
|
||||||
* whenever a null data source is encountered (this can be because mDataProp
|
* whenever a null data source is encountered (this can be because mData
|
||||||
* is set to null, or because the data source itself is null).
|
* is set to null, or because the data source itself is null).
|
||||||
* @type string
|
* @type string
|
||||||
* @default null
|
* @default null
|
||||||
|
@ -147,7 +147,7 @@ DataTable.defaults.columns = {
|
|||||||
* rendered data that the user can see). This may be useful for dates etc.
|
* rendered data that the user can see). This may be useful for dates etc.
|
||||||
*
|
*
|
||||||
* *NOTE* This property is now deprecated, and it is suggested that you use
|
* *NOTE* This property is now deprecated, and it is suggested that you use
|
||||||
* mDataProp and / or mRender to render data for the DataTable.
|
* mData and / or mRender to render data for the DataTable.
|
||||||
* @type boolean
|
* @type boolean
|
||||||
* @default true
|
* @default true
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
@ -335,9 +335,18 @@ DataTable.defaults.columns = {
|
|||||||
"iDataSort": -1,
|
"iDataSort": -1,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This parameter has been replaced by mData in DataTables to ensure naming
|
||||||
|
* consistency. mDataProp can still be used, as there is backwards compatibility
|
||||||
|
* in DataTables for this option, but it is strongly recommended that you use
|
||||||
|
* mData in preference to mDataProp.
|
||||||
|
* @name DataTable.defaults.columns.mDataProp
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property can be used to read data from any JSON data source property,
|
* This property can be used to read data from any JSON data source property,
|
||||||
* including deeply nested objects / properties. mDataProp can be given in a
|
* including deeply nested objects / properties. mData can be given in a
|
||||||
* number of different ways which effect its behaviour:
|
* number of different ways which effect its behaviour:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>integer - treated as an array index for the data source. This is the
|
* <li>integer - treated as an array index for the data source. This is the
|
||||||
@ -364,6 +373,11 @@ DataTable.defaults.columns = {
|
|||||||
* of call, but otherwise the return is what will be used for the data
|
* of call, but otherwise the return is what will be used for the data
|
||||||
* requested.</li>
|
* requested.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
|
* Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change
|
||||||
|
* reflects the flexibility of this property and is consistent with the naming of
|
||||||
|
* mRender. If 'mDataProp' is given, then it will still be used by DataTables, as
|
||||||
|
* it automatically maps the old name to the new if required.
|
||||||
* @type string|int|function|null
|
* @type string|int|function|null
|
||||||
* @default null <i>Use automatically calculated column index</i>
|
* @default null <i>Use automatically calculated column index</i>
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
@ -374,24 +388,24 @@ DataTable.defaults.columns = {
|
|||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "sAjaxSource": "sources/deep.txt",
|
* "sAjaxSource": "sources/deep.txt",
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "mDataProp": "engine" },
|
* { "mData": "engine" },
|
||||||
* { "mDataProp": "browser" },
|
* { "mData": "browser" },
|
||||||
* { "mDataProp": "platform.inner" },
|
* { "mData": "platform.inner" },
|
||||||
* { "mDataProp": "platform.details.0" },
|
* { "mData": "platform.details.0" },
|
||||||
* { "mDataProp": "platform.details.1" }
|
* { "mData": "platform.details.1" }
|
||||||
* ]
|
* ]
|
||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Using mDataProp as a function to provide different information for
|
* // Using mData as a function to provide different information for
|
||||||
* // sorting, filtering and display. In this case, currency (price)
|
* // sorting, filtering and display. In this case, currency (price)
|
||||||
* $(document).ready(function() {
|
* $(document).ready(function() {
|
||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "aTargets": [ 0 ],
|
* "aTargets": [ 0 ],
|
||||||
* "mDataProp": function ( source, type, val ) {
|
* "mData": function ( source, type, val ) {
|
||||||
* if (type === 'set') {
|
* if (type === 'set') {
|
||||||
* source.price = val;
|
* source.price = val;
|
||||||
* // Store the computed dislay and filter values for efficiency
|
* // Store the computed dislay and filter values for efficiency
|
||||||
@ -412,16 +426,15 @@ DataTable.defaults.columns = {
|
|||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
*/
|
*/
|
||||||
"mDataProp": null,
|
"mData": null,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property is the rendering partner to mDataProp and it is suggested that
|
* This property is the rendering partner to mData and it is suggested that
|
||||||
* when you want to manipulate data for display (including filtering, sorting etc)
|
* when you want to manipulate data for display (including filtering, sorting etc)
|
||||||
* but not altering the underlying data for the table, use this property. mDataProp
|
* but not altering the underlying data for the table, use this property. mData
|
||||||
* can actually do everything this property can and more, but this parameter is
|
* can actually do everything this property can and more, but this parameter is
|
||||||
* easier to use since there is no 'set' option. Like mDataProp is can be given
|
* easier to use since there is no 'set' option. Like mData is can be given
|
||||||
* in a number of different ways to effect its behaviour, with the addition of
|
* in a number of different ways to effect its behaviour, with the addition of
|
||||||
* supporting array syntax for easy outputting of arrays (including arrays of
|
* supporting array syntax for easy outputting of arrays (including arrays of
|
||||||
* objects):
|
* objects):
|
||||||
@ -439,16 +452,16 @@ DataTable.defaults.columns = {
|
|||||||
* needs to set or get the data for a cell in the column. The function
|
* needs to set or get the data for a cell in the column. The function
|
||||||
* takes three parameters:
|
* takes three parameters:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{array|object} The data source for the row (based on mDataProp)</li>
|
* <li>{array|object} The data source for the row (based on mData)</li>
|
||||||
* <li>{string} The type call data requested - this will be 'filter', 'display',
|
* <li>{string} The type call data requested - this will be 'filter', 'display',
|
||||||
* 'type' or 'sort'.</li>
|
* 'type' or 'sort'.</li>
|
||||||
* <li>{array|object} The full data source for the row (not based on mDataProp)</li>
|
* <li>{array|object} The full data source for the row (not based on mData)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* The return value from the function is what will be used for the data
|
* The return value from the function is what will be used for the data
|
||||||
* requested.</li>
|
* requested.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @type string|int|function|null
|
* @type string|int|function|null
|
||||||
* @default null <i>Use mDataProp</i>
|
* @default null <i>Use mData</i>
|
||||||
* @dtopt Columns
|
* @dtopt Columns
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
@ -457,10 +470,10 @@ DataTable.defaults.columns = {
|
|||||||
* var oTable = $('#example').dataTable( {
|
* var oTable = $('#example').dataTable( {
|
||||||
* "sAjaxSource": "sources/deep.txt",
|
* "sAjaxSource": "sources/deep.txt",
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "mDataProp": "engine" },
|
* { "mData": "engine" },
|
||||||
* { "mDataProp": "browser" },
|
* { "mData": "browser" },
|
||||||
* {
|
* {
|
||||||
* "mDataProp": "platform",
|
* "mData": "platform",
|
||||||
* "mRender": "[, ].name"
|
* "mRender": "[, ].name"
|
||||||
* }
|
* }
|
||||||
* ]
|
* ]
|
||||||
@ -474,7 +487,7 @@ DataTable.defaults.columns = {
|
|||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "aTargets": [ 0 ],
|
* "aTargets": [ 0 ],
|
||||||
* "mDataProp": "download_link",
|
* "mData": "download_link",
|
||||||
* "mRender": function ( data, type, full ) {
|
* "mRender": function ( data, type, full ) {
|
||||||
* return '<a href="'+data+'">Download</a>';
|
* return '<a href="'+data+'">Download</a>';
|
||||||
* }
|
* }
|
||||||
@ -575,7 +588,7 @@ DataTable.defaults.columns = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a default value to be given for a column's data, and will be used
|
* Allows a default value to be given for a column's data, and will be used
|
||||||
* whenever a null data source is encountered (this can be because mDataProp
|
* whenever a null data source is encountered (this can be because mData
|
||||||
* is set to null, or because the data source itself is null).
|
* is set to null, or because the data source itself is null).
|
||||||
* @type string
|
* @type string
|
||||||
* @default null
|
* @default null
|
||||||
@ -587,7 +600,7 @@ DataTable.defaults.columns = {
|
|||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "aoColumnDefs": [
|
* "aoColumnDefs": [
|
||||||
* {
|
* {
|
||||||
* "mDataProp": null,
|
* "mData": null,
|
||||||
* "sDefaultContent": "Edit",
|
* "sDefaultContent": "Edit",
|
||||||
* "aTargets": [ -1 ]
|
* "aTargets": [ -1 ]
|
||||||
* }
|
* }
|
||||||
@ -604,7 +617,7 @@ DataTable.defaults.columns = {
|
|||||||
* null,
|
* null,
|
||||||
* null,
|
* null,
|
||||||
* {
|
* {
|
||||||
* "mDataProp": null,
|
* "mData": null,
|
||||||
* "sDefaultContent": "Edit"
|
* "sDefaultContent": "Edit"
|
||||||
* }
|
* }
|
||||||
* ]
|
* ]
|
||||||
|
@ -34,7 +34,7 @@ DataTable.defaults = {
|
|||||||
* } );
|
* } );
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Using an array of objects as a data source (mDataProp)
|
* // Using an array of objects as a data source (mData)
|
||||||
* $(document).ready( function () {
|
* $(document).ready( function () {
|
||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "aaData": [
|
* "aaData": [
|
||||||
@ -54,11 +54,11 @@ DataTable.defaults = {
|
|||||||
* }
|
* }
|
||||||
* ],
|
* ],
|
||||||
* "aoColumns": [
|
* "aoColumns": [
|
||||||
* { "sTitle": "Engine", "mDataProp": "engine" },
|
* { "sTitle": "Engine", "mData": "engine" },
|
||||||
* { "sTitle": "Browser", "mDataProp": "browser" },
|
* { "sTitle": "Browser", "mData": "browser" },
|
||||||
* { "sTitle": "Platform", "mDataProp": "platform" },
|
* { "sTitle": "Platform", "mData": "platform" },
|
||||||
* { "sTitle": "Version", "mDataProp": "version" },
|
* { "sTitle": "Version", "mData": "version" },
|
||||||
* { "sTitle": "Grade", "mDataProp": "grade" }
|
* { "sTitle": "Grade", "mData": "grade" }
|
||||||
* ]
|
* ]
|
||||||
* } );
|
* } );
|
||||||
* } );
|
* } );
|
||||||
|
@ -92,8 +92,8 @@ DataTable.models.ext = {
|
|||||||
* </il>
|
* </il>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Note that as of v1.9, it is typically preferable to use <i>mDataProp</i> to prepare data for
|
* Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
|
||||||
* the different uses that DataTables can put the data to. Specifically <i>mDataProp</i> when
|
* the different uses that DataTables can put the data to. Specifically <i>mData</i> when
|
||||||
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
||||||
* prepare the data as required for the different types. As such, this method is deprecated.
|
* prepare the data as required for the different types. As such, this method is deprecated.
|
||||||
* @type array
|
* @type array
|
||||||
@ -258,8 +258,8 @@ DataTable.models.ext = {
|
|||||||
* </il>
|
* </il>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Note that as of v1.9, it is typically preferable to use <i>mDataProp</i> to prepare data for
|
* Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
|
||||||
* the different uses that DataTables can put the data to. Specifically <i>mDataProp</i> when
|
* the different uses that DataTables can put the data to. Specifically <i>mData</i> when
|
||||||
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
* used as a function will give you a 'type' (sorting, filtering etc) that you can use to
|
||||||
* prepare the data as required for the different types. As such, this method is deprecated.
|
* prepare the data as required for the different types. As such, this method is deprecated.
|
||||||
* @type object
|
* @type object
|
||||||
|
@ -18,7 +18,7 @@ DataTable.models.oRow = {
|
|||||||
/**
|
/**
|
||||||
* Data object from the original data source for the row. This is either
|
* Data object from the original data source for the row. This is either
|
||||||
* an array if using the traditional form of DataTables, or an object if
|
* an array if using the traditional form of DataTables, or an object if
|
||||||
* using mDataProp options. The exact type will depend on the passed in
|
* using mData options. The exact type will depend on the passed in
|
||||||
* data from the data source, or will be an array if using DOM a data
|
* data from the data source, or will be an array if using DOM a data
|
||||||
* source.
|
* source.
|
||||||
* @type array|object
|
* @type array|object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user