Function to force internal cache refresh

Function to force internal cache refresh

NeoEGMNeoEGM Posts: 1Questions: 0Answers: 0
edited August 2011 in Bug reports
Currently, there is no way to force the internal cache to refresh...

It's needed, for example, in this situation: you have a column made of option boxes. You've correctly set the $.fn.dataTableExt.afnSortData['control-select'] function in order for it to be sorted. But you're using DataTables Column Filter Plug-in. It uses internal cache to do the filtering, but the cache is not correct until you sort the column with the selects for the first time...

So, you could call, let's say:

$('#filtered_table').dataTable().fnRefreshCache(8)

given that the column we're talking about is the column 8...

Here is my implementation (working) of the fnRefreshCache column for the 1.8.1 version:

[code]
this.fnRefreshCache = function( iCol )
{
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
var aoData = oSettings.aoData;
var aoColumns = oSettings.aoColumns;

var iVisColumn = _fnColumnIndexToVisible( oSettings, iCol );
var sDataType = oSettings.aoColumns[ iCol ].sSortDataType;
if ( typeof _oExt.afnSortData[sDataType] != 'undefined' )
{
var aData = _oExt.afnSortData[sDataType]( oSettings, iCol, iVisColumn );
for ( var j=0, jLen=aoData.length ; j
This discussion has been closed.