How can I hide my 1st colum searchbox in datatable
How can I hide my 1st colum searchbox in datatable
bhowmick
Posts: 3Questions: 2Answers: 0
I have a data table where user can filter data using column search filed and global search box. Moreover I have check-box for selecting multiple rows for exporting data. My problem is here I want to hide search box underneath of check box column. My code looks like this:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#example tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
// DataTable
var table = $('#example').DataTable( {'scrollX':true, 'dom': 'Blfrtip',
buttons: [{ extend: 'csv',text: 'CSV all',exportOptions: {columns: [1,2,3,4,5,6,7,8,9,12,13,14]}},{extend: 'csv',text: 'CSV selected',exportOptions: {columns: [1,2,3,4,5,6,7,8,9,12,13,14],modifier: {selected: true}}}],
columnDefs: [ { orderable: false, className: 'select-checkbox',targets:[0]},{targets: [ 13,14 ],visible: false,searchable: false} ],
select: {style: 'multi',selector: 'td:first-child'},
order: [[ 1, 'asc' ]]
} );
// Apply the search
table.columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
} );
</script>
Anyone has any idea how to do it? Thanks
This discussion has been closed.