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

Issue with fnFilter [solved]

$
0
0
I'm using the example here:

http://datatables.net/examples/api/multi_filter.html

to use the fnFilter, however when I call it in my browser (Chrome) I'm getting the following:

Uncaught TypeError: Object [object Object] has no method 'fnFilter'

Here's my code, any help would be GREATLY appreciated.


<script defer src="js/mylibs/jquery.dataTables.js"></script>
<script defer>
	
	
	var asInitVals = new Array();
	
	$(window).load(function() {
	
		var oTable = $('#table-example').dataTable();
		
		//$(window).resize();
		
		$("tfoot input").keyup( function () {
			// Filter on the column (the index) of this element 
			oTable.fnFilter( this.value, $("tfoot input").index(this) );
		});
	

		/*
		 * Support functions to provide a little bit of 'user friendlyness' to the textboxes in 
		 * the footer
		 */
		$("tfoot input").each( function (i) {
			asInitVals[i] = this.value;
		});
		
		$("tfoot input").focus( function () {

			if ( this.className == "search_init" )
			{
				this.className = "";
				this.value = "";
			}
		});

		$("tfoot input").blur( function (i) {
			if ( this.value == "" )
			{
				this.className = "search_init";
				this.value = asInitVals[$("tfoot input").index(this)];
			}
		});
		

	});
</script>

Edit:

Also, I should note that the table is being "datatable-ified" fine, and the global search is working correctly, it's just the column filters that are causing issues.

Solved:

I'm not 100% sure what the problem is, I had the <script src="jquery.dataTables.js"></script> way up in the header, and I moved it to right above the code I was trying to execute, and all started to work.

Viewing all articles
Browse latest Browse all 81999

Trending Articles



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