Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82331

afnFiltering function never called

$
0
0
First of all, thanks for the product - looks very thorough.

I'm trying to use the afnFiltering function to implement a customer filter but it seems that the function is never called despite my issuing the fnDraw() on the dataTable object. Is there any way to test whether the function gets called and that the failure of the filter code to actually filter out any rows is due to the code in the filter function itself? Here is the function as I have implemented it:

$.fn.dataTableExt.afnFiltering.push(
	function( oSettings, aData, iDataIndex ) {
		//alert('Custom filtering taking place NOW!!!');
		var strFilters = new Array();
		var boolReturn = true;
		$("#ProductAccordion table:first thead tr td").each(function(index) {
			strFilters[index] = '';
			$(this).find("input[type='checkbox']:not('.allCheck')").each(function() {
				if($(this).is(':checked')) {
					strFilters[index] += '|' + $(this).attr('id');
				}
			});
			if (strFilters[index] != '') {
				strFilters[index] = strFilters[index].substr(1);
			}
		});
		for (var i=0; i < strFilters.length; i++) {
			var regExpCol = new RegExp(strFilters[i]);
			boolReturn = boolReturn & regExpCol.test(aData[i]);
		}
		return boolReturn;
	}
);

The alert, even if uncommented, does not appear.

Tanks in advance.

Viewing all articles
Browse latest Browse all 82331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>