Individual column searching (select inputs) several meanings in filter

Individual column searching (select inputs) several meanings in filter

czaaczaa Posts: 3Questions: 3Answers: 0
edited November 2016 in Free community support

Hello. Let suppose that I have the table at 2 columns: name and profession. And then I want use 'Individual column searching (select inputs)' on the profession column. Ok, but I have one problem: Individual column searching can filter only by ONE meanings. And is it possible to filter by more then one meaning? For example, I want that my table show peoples who has profession teacher and manager.

And that is my code


$(document).ready(function() { $('#sch').DataTable( { "lengthMenu": [[50, -1], [50, "All"]], initComplete: function () { this.api().columns().every( function () { var column = this; var select = $('<select><option value=""></option></select>') .appendTo( $(column.footer()).empty() ) .on( 'change', function () { var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); column .search( val ? '^'+val+'$' : '', true, false ) .draw(); } ); column.cells('', column[0]).render('display').sort().unique().each( function ( d, j ) { if(column.search() === '^'+d+'$'){ select.append( '<option value="'+d+'" selected="selected">'+d+'</option>' ) } else { select.append( '<option value="'+d+'">'+d+'</option>' ) } } ); } ); } } ); } );
This discussion has been closed.