My table has 2 rows in the table header. The first row contains th elements that may or may not contain a select element. I want to push filter functions into $.fn.dataTableExt.afnFiltering but specify the column index of the column being filtered. I am using the code shown below. Notice I am passing the col parameter to the filter function. The alert never gets called. How can I make this work?
Thanks!
Robert
var initializeFiltering = function ($this, settings) { var filter = function (oSettings, aData, iDataIndex, col) { if (col > 0) { alert("!"); } if (settings.$reportDataTable == undefined || oSettings.nTable != settings.$reportDataTable[0]) { return true; } switch (settings.filters[col].value) { case "*": return true; default: return oSettings.aoData[iDataIndex]._aData[col] == settings.filters[col].value; //// CAUTION INDICIES } return true; }; settings.filters = []; $("#ReportDataTable").find("tr.filters").find("th").each(function (index, ui) { settings.filters.push({}); $.fn.dataTableExt.afnFiltering.push(function (oSettings, aData, iDataIndex) { filter(oSettings, aData, iDataIndex, index); }); }); };
Thanks!
Robert