Filter/sort cache updates for sorting but not filtering

Filter/sort cache updates for sorting but not filtering

WintermuteWintermute Posts: 1Questions: 0Answers: 0
edited August 2012 in Bug reports
I followed this method (http://datatables.net/development/sorting) to update the sorting cache for user-entered data, and it works for sorting but not filtering. In the official example (http://datatables.net/release-datatables/extras/AutoFill/inputs.html) you can see this problem; if you enter new data in a field, and then filter for that data without sorting first, the new data will not be found. If the table is sorted first before filtering it works, because the cache is shared. I adapted this code for manually refreshing the internal cache by column for 1.8 and 1.7 (http://www.datatables.net/forums/discussion/6039/function-to-force-internal-cache-refresh/p1) to 1.9.1:

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

var iVisColumn = _fnColumnIndexToVisible( oSettings, iCol );
var sDataType = oSettings.aoColumns[ iCol ].sSortDataType;
if ( typeof DataTable.ext.afnSortData[sDataType] != 'undefined' )
{
var aData = DataTable.ext.afnSortData[sDataType]( oSettings, iCol, iVisColumn );
for ( var j=0, jLen=aoData.length ; j

Replies

  • allanallan Posts: 61,916Questions: 1Answers: 10,150 Site admin
    Yes - superb. Thank you for this method. I've been thinking about this particular issue with DataTables and how best to handle it. I don't think it will make it into 1.9.3, as I'm trying got wrap that up now, but I will look at getting this into the next release.

    Regards,
    Allan
This discussion has been closed.