Filter one column header
Filter one column header

I am unable to create a grid with filter in the header. When he puts the select, sits atop the title and when you click the select, it changes the order of the column.
I need a line to the filter and one with the title of the column and order.
var table = $('#myTable').DataTable({
sDom: '<"H"lTfr>t<"F"ip>',
order: [[2, 'desc'], [1, 'asc'], [4, 'asc']],
pagingType: 'full_numbers',
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "Todos"]],
searchHighlight: true,
jQueryUI: true,
ajax: ret[0],
orderClasses: true,
bDeferRender: true,
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select><option value=""></option></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('<option value="' + d + '">' + d + '</option>');
} );
} );
},
} );
This discussion has been closed.