$(document).ready(function() {
/*
Column Filter
*/
cf = $('#column-filter').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
headerCallback:function(e, a, t, n, s) {
e.getElementsByTagName("th")[0].innerHTML=''
},
columnDefs:[ {
targets:0, width:"30px", className:"", orderable:!1, render:function(e, a, t, n) {
return''
}
}],
"oLanguage": {
"oPaginate": { "sPrevious": '', "sNext": '' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
});
multiCheck(cf);
/*
Individual Column Search
*/
// Setup - add a text input to each footer cell
$('#individual-col-search tfoot th').each( function () {
var title = $(this).text();
$(this).html( '' );
} );
// DataTable
var table = $('#individual-col-search').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '', "sNext": '' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
});
// 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();
}
} );
} );
/*
Show Hide column
*/
var table = $('#show-hide-col').DataTable( {
"dom": "<'dt--top-section'<'row'<'col-sm-12 col-md-6 d-flex justify-content-md-start justify-content-center'B><'col-sm-12 col-md-6 d-flex justify-content-md-end justify-content-center mt-md-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '', "sNext": '' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
buttons: [
{
text: 'Name',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 0 );
column.visible( ! column.visible() );
}
},
{
text: 'Position',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 1 );
column.visible( ! column.visible() );
}
},
{
text: 'Office',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 2 );
column.visible( ! column.visible() );
}
},
{
text: 'Age',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 3 );
column.visible( ! column.visible() );
}
},
{
text: 'Start date',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 4 );
column.visible( ! column.visible() );
}
},
{
text: 'Salary',
className: 'btn btn-primary btn-sm toggle-vis mb-1',
action: function(e, dt, node, config ) {
var column = table.column( 5 );
column.visible( ! column.visible() );
}
},
],
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
} );
} );