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:
dataTables features
I knew I had done this before, and you have to watch this little piece of information:
Note that if you wish to use filtering in DataTables this must remain 'true' - to remove the default filtering input box and retain filtering abilities, please use sDom.
you need to set {bFilter:true}, and move your into a custom element registered through sDom. I can guess your code will look like this:
$(document).ready(function() {
$("#msds-table").dataTable({
"sPaginationType": "full_numbers",
"bFilter": true,
"sDom":"lrtip" // default is lfrtip, where the f is the filter
});
var oTable;
oTable = $('#msds-table').dataTable();
$('#msds-select').change( function() {
oTable.fnFilter( $(this).val() );
});
});
your code for oTable.fnFilter( $(this).val() );
will not fire while {bFilter:false};
according to the documentation