Custom Filtering and Sorting issue

Custom Filtering and Sorting issue

murxmanmurxman Posts: 3Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Hello everybody and especially Allen,

I have a question concerning custom filtering and custom sorting. In my code I register for both actions a custom function which looks like this:

[code]
jQuery.fn.dataTableExt.afnFiltering.push( this._fnMakeFilterCallback() );
jQuery.fn.dataTableExt.afnSortData[ 'Sheet' ] = this._fnMakeSortingCallback();
[/code]

The filtering function is not of a big concern because as long as it is called without sorting it works fine. However, when I set the sSortDataType option in my column definitions to 'Sheet', I will get alert boxes like this:

'Requested unknown parameter '0' from the data source for row 0'

On introducing a throw 'halt' for instance, directly before DataTables opens this alert box, I can see that in the stack trace that _fnCustomFilter() was called beforehand. I also tried to change the order of instantiating a DataTable instance and registering the two callbacks what also does not seem to help.

My question now: Is one not able to customize filtering and sorting at the same time in DataTables? Below you will find some more snippets of my code to help you understand the problem. Unfortunately the code is not yet online and cannot be published yet.

[code]
jQuery.fn.dataTableExt.afnFiltering.push( this._fnMakeFilterCallback() );
jQuery.fn.dataTableExt.afnSortData[ 'Sheet' ] = this._fnMakeSortingCallback();

// Create the DataTables instance
var oDataTable = nTable.dataTable( {
'bAutoWidth' : false,
'bJQueryUI' : true,

'sDom' : '<"H"lfr>Ct<"F"ip>',
'sPaginationType' : 'full_numbers',

'aoColumns' : [{
'sTitle' : 'Foo',
'sType' : 'string',
'sSortDataType' : 'Sheet'
}, {
'sTitle' : 'Bar',
'sType' : 'string',
'sSortDataType' : 'Sheet'
}],
'aaSorting' : this._fnGetInitialSorting( aoColumns ),

// ColVis extra
'oColVis' : {
'activate' : 'mouseover',
'buttonText' : ' ',

'bRestore' : true,

'sAlign' : 'left'
}
});

Sheet.prototype._fnMakeFilterCallback = function() {
return function( oSettings, aData, iDataIndex ) {
...
}
}

Sheet.prototype._fnMakeSortingCallback = function() {
return function( oSettings, iColumn, iVisibleColumn ) {
...
}
}
[/code]
This discussion has been closed.