Filter/sort cache updates for sorting but not filtering
Filter/sort cache updates for sorting but not filtering
Wintermute
Posts: 1Questions: 0Answers: 0
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
[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
This discussion has been closed.
Replies
Regards,
Allan