Ignored value

Ignored value

benzittlaubenzittlau Posts: 1Questions: 0Answers: 0
edited November 2011 in Plug-ins
I would propose a change to the way type detection is currently working. In our table we would like to use the value '-' to represent blank fields. This was working fine until I attempted to implement custom type detection.

Here is the type detection block from the current _fnGatherData function:
[code]
/* Type detection */
if ( bAutoType && oSettings.aoColumns[iColumn].sType != 'string' )
{
sValType = _fnGetCellData( oSettings, iRow, iColumn, 'type' );
if ( sValType !== '' )
{
sThisType = _fnDetectType( sValType );
if ( oSettings.aoColumns[iColumn].sType === null )
{
oSettings.aoColumns[iColumn].sType = sThisType;
}
else if ( oSettings.aoColumns[iColumn].sType != sThisType &&
oSettings.aoColumns[iColumn].sType != "html" )
{
/* String is always the 'fallback' option */
oSettings.aoColumns[iColumn].sType = 'string';
}
}
}

[/code]

The way this works, it will take any value that is not a blank (the sValType !== '' check), and then will check the type for that value. If it gets conflicting results for different rows in a column, it will set the column type to string (the last else if).

This means the *only* ignored value is hardcoded to '', and that if there's value that is caught by multiple types (for example '-'), then the type detection will end up as 'string' for that column.

I would propose that instead of just checking against a blank '' value, that the ignored values for type detection should be a configurable setting that would allow for multiple ignored allows settable by the user.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    having a configurable set of "blank" values is reasonable, but in the meantime you can work around this by outputting blank entries in your table, but using fnRender to render them as "-" values, and use bUseRendered: false to use the original data (empty string) in search/sort.

    I'm not fully sure if the bUseRendered affects the type-detection, but I suspect it will.
This discussion has been closed.