[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2141
  • Last Modified:

Jquery DataTables simple custom filter

I'm trying to bind the following DataTables filter to a select on change event.
The onchange event fires it gets the selected value correctly but I am being defeated by the filter it does nothing to the table at present, any help appreciated

The onchange event fires the following filter function.
function onSelectChange(){
		var selected = $("#status_select option:selected").val();
		 $.fn.dataTableExt.afnFiltering.push(
					function( oSettings, aData, iDataIndex ) {
						var iColumn =6;
						var selected = $("#status_select option:selected");
						var output = selected.val();
						var iVersion = aData[6] == "-" ? 0 : aData[6]*1;
						if(slected == iVersion){return true;}
						return false;
						oTable.fnDraw();
					});
	}

Open in new window


Help appreciated.
0
bjh497
Asked:
bjh497
  • 3
1 Solution
 
BurniePCommented:
You have return false before you draw.  So oTable.fnDraw(); will not execute.

return false;
oTable.fnDraw();

Maybe ? :

oTable.fnDraw();
return false;
0
 
bjh497Author Commented:
no joy,
 I don't think I need the the oTable.fnDraw(); at all I think the filter push already does it it was just a stab in the dark earlier.
0
 
bjh497Author Commented:
oTable isn't a plugin variable has to be declared.
0
 
bjh497Author Commented:
otable was an undeclared variable.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now