Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82136

_fnGetCellData doesn't test for column existence

$
0
0
Hi. Could _fnGetCellData test if a column exists before getting its settings?
The issue is here:
function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
{
var sData;
var oCol = oSettings.aoColumns[iCol];
var oData = oSettings.aoData[iRow]._aData;
if ( (sData=oCol.fnGetData( oData, sSpecific )) === undefined )
This last line is a Javascript error when oCol is undefined, which happens when oSettings.aoColumns[iCol] doesn't exist.

Putting a breakpoint here and looking at the stack trace, it seems to happen when _fnFilterColumn is called but the column the table was filtered on is not in the table anymore (by design, we decided to remove it). The sorting was serialized with the table state and then restored, but the column isn't there anymore.
function _fnFilterColumn ( oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive )
{
if ( sInput === "" )
{
return;
}
var iIndexCorrector = 0;
var rpSearch = _fnFilterCreateSearch( sInput, bRegex, bSmart, bCaseInsensitive );
for ( var i=oSettings.aiDisplay.length-1 ; i>=0 ; i-- )
{
var sData = _fnDataToSearch( _fnGetCellData( oSettings, oSettings.aiDisplay[i], iColumn, 'filter' ),
That last line calls fnGetCellData.
Would you advise a workaround?
Thanks

Viewing all articles
Browse latest Browse all 82136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>