$.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { console.log(aData[1]); var ret = true; //Loop through all input fields i tfoot that has class 'sl_filter' attached $('tfoot .sl_filter').each(function(i, obj){ //$(this) can be used. Get the index of this colum. var i2 = $("tfoot input").index($(this)); i2 = oTable.fnVisibleToColumnIndex(i2); //Create regexp to math var r = new RegExp($(this).val(), "i"); //HTML does not get updated when changing value in select, hence searching for :selected return old value //DataTables stores the DOM object oSettings. Hence, get the object and extract the text for the selected value. var tr = oSettings.aoData[ iDataIndex ].nTr; var id = $(aData[i2]).attr('id'); //Get the text var str = ""; var value = ""; if($(aData[i2]).is("form")){ value = $("#" + id + " select", tr).val(); str = $("#" + id + " select option[value='" + value + "']", tr).text(); }else{ value = $("#" + id, tr).val(); str = $("#" + id + " option[value='" + value + "']", tr).text(); } /*Test to see if there is a match or if the input value is the default (the initial value of input before it has any fokus/text) */ if(r.test(str) || $(this).val()=="Search"){ //Return true only exits this function return true; }else{ /*Return false returns both function an .each. Retain 'false' in a variable scoped to be reached outside the .each */ ret = false; return false; } }); //Return true or false return ret; } ); $.fn.dataTableExt.afnSortData['dom-select'] = function ( oSettings, iColumn, iColumnVis){ iColumn = oSettings.oApi._fnColumnIndexToVisible( oSettings, iColumn ); var aData = []; $( 'td:eq('+iColumn+') select', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () { aData.push( $.trim($(":selected", this).text())); } ); return aData; }; str = $('td:eq(' + i2 + ') option:selected', oSettings.aoData[ iDataIndex ].nTr).text(); $.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { var ret = true; //Loop through all input fields i tfoot that has class 'sl_filter' attached $('tfoot .sl_filter').each(function(i, obj){ //$(this) can be used. Get the index of this colum. var i2 = $("tfoot input").index($(this)); //Create regexp to math var r = new RegExp($(this).val(), "i"); //Get the text var str = $('td:eq(' + i2 + ') option:selected', oSettings.aoData[ iDataIndex ].nTr).text(); /*Test to see if there is a match or if the input value is the default (the initial value of input before it has any fokus/text) */ if(r.test(str) || $(this).val()=="Search"){ //Return true only exits this function return true; }else{ /*Return false returns both function an .each. Retain 'false' in a variable scoped to be reached outside the .each */ ret = false; return false; } }); //Return true or false return ret; } );