How to clear dropdown filters of datatables
How to clear dropdown filters of datatables
khubab
Posts: 10Questions: 3Answers: 0
Here is my code using drpodown filters
$(document).ready(function() {
$('#example1').DataTable( {
dom: 'Bfrtip',
buttons: ['excel'],
lengthChange: true,
paging: false,
scrollY: 520,
scrollX: false,
sScrollXInner: "190%" ,
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.css('width',85)
.appendTo( $(column.footer()).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.