I am automatically hiding field 5, 7 when I click to enable both the search field does not come together how to solve this? thank you
My Code
$(document).ready(function() {
var advance = $('#advanced-table').DataTable( {
dom: 'Blfrtip',
columnDefs: [
{
targets: 1,
className: 'noVis',
},
{
"targets": [ 5 ],
"visible": false,
"searchable": true,
},
{
"targets": [ 7 ],
"visible": false,
"searchable": true,
}
],
buttons: {
name: 'primary',
buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print', 'colvis' ]
},
//"language": {
//"url": "http://cdn.datatables.net/plug-ins/1.10.13/i18n/Portuguese-Brasil.json"
// }
} );
$(document).ready(function() {
$('a.toggle-vis').on('click', function (e) {
e.preventDefault();
// table
var table = $('#advanced-table').dataTable();
// column
var ColNum = $(this).attr('data-column');
// Define
var bVis = table.fnSettings().aoColumns[ColNum].bVisible;
// Toggle
table.fnSetColumnVis(ColNum, bVis ? false : true);
});
});
// Setup - add a text input to each footer cell
$('#advanced-table tfoot th').each( function () {
var title = $(this).text();
$(this).html( '
' );
} );
// Apply the search
advance.columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
} );