I\'m using the dataTables jQuery plugin (which is totally awesome), but I\'m having trouble getting my table to filter based on the change of my select box.
Function:
$.extend( true, $.fn.dataTable.defaults, {
"bFilter": true,
initComplete: function () {
this.api().column(1).every( function () {
var column = this;
var select = $('')
.appendTo( $(column.header()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex($(this).val());
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '' )
} );
} );
},
} );