1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-18 16:54:14 +01:00

New: Pass the cell read 'specific' type to mDataProp if it is given as a function. This might seem like a really simple change, but it greatly expands the flexibility of DataTables. It means that for a column, if you define this function and switch between the four 'get' data types for the cell ('display', 'type', 'filter' or 'sort') you can use different data for each one. So for example you could display a formatted number but do sorting on the numeric version of the number, and filtering on both types (so the user can type either version). The "type" option is for DataTables' type detection. Most of the framework for this was in 1.8.0 - I had thought to include options such as mFilterData (and might in future), but this is the first step to do that without introducing much overhead.

This commit is contained in:
Allan Jardine 2011-11-14 08:34:29 +00:00
parent 30a437d80e
commit 4c48650a25

View File

@ -6667,7 +6667,7 @@
var oCol = oSettings.aoColumns[iCol];
var oData = oSettings.aoData[iRow]._aData;
if ( (sData=oCol.fnGetData( oData )) === undefined )
if ( (sData=oCol.fnGetData( oData, sSpecific )) === undefined )
{
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
{
@ -6731,8 +6731,8 @@
}
else if ( typeof mSource == 'function' )
{
return function (data) {
return mSource( data );
return function (data, type) {
return mSource( data, type );
};
}
else if ( typeof mSource == 'string' && mSource.indexOf('.') != -1 )