Invalidate rows when global filter is used?
Invalidate rows when global filter is used?
guillochon
Posts: 56Questions: 19Answers: 0
I'd like to invalidate rows when the global filter is used, however I don't know how to access the invalidate function from within a search function.
Here's what I currently have, comment is where I'd like to invalidate:
jQuery.fn.dataTable.ext.search.push(
function( oSettings, aData, iDataIndex ) {
for ( var i = 0; i < aData.length; i++ )
{
if ( floatColInds.indexOf(i) !== -1 ) {
if ( !advancedFloatFilter( aData[i], floatColValDict[i] ) ) return false;
}
}
// INVALIDATE ROW HERE, BUT WHAT FUNCTION?
return true;
}
);
This discussion has been closed.
Answers
Hmmm, I think all I want to do is invalidate the "current" rows, but the function being pushed to search runs on every row one by one. So what I need to do is push a function to search that only runs once, after the filtering has completed.
You could potentially use
new $.fn.dataTable.Api( oSettings ).row( iDataIndex ).invalidate()
, but that sounds horribly expensive to me. What's the use case?I would have said you would be much better invalidating the data after the data has been updated.
Allan
You could potentially use
new $.fn.dataTable.Api( oSettings ).row( iDataIndex ).invalidate()
, but that sounds horribly expensive to me. What's the use case?I would have said you would be much better invalidating the data after the data has been updated.
Allan
OK, figured it out! You need to attach to the search event:
This will invalidate all rows on the current page before the redraw, exactly what I was looking for.