equation-admin-template
Version:
Booststrap 4 admin template made by equation
80 lines (66 loc) • 2.7 kB
JavaScript
$(document).ready(function() {
/*
Column Filter
*/
cf = $('#column-filter').DataTable({
headerCallback:function(e, a, t, n, s) {
e.getElementsByTagName("th")[0].innerHTML='<label class="new-control new-checkbox checkbox-primary m-auto">\n<input type="checkbox" class="new-control-input chk-parent select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
},
columnDefs:[ {
targets:0, width:"30px", className:"", orderable:!1, render:function(e, a, t, n) {
return'<label class="new-control new-checkbox checkbox-primary m-auto">\n<input type="checkbox" class="new-control-input child-chk select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
}
}],
"language": {
"paginate": {
"previous": "<i class='flaticon-arrow-left-1'></i>",
"next": "<i class='flaticon-arrow-right'></i>"
},
"info": "Showing page _PAGE_ of _PAGES_"
}
});
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( '<input type="text" class="form-control" placeholder="Search '+title+'" />' );
} );
// DataTable
var table = $('#individual-col-search').DataTable({
"language": {
"paginate": {
"previous": "<i class='flaticon-arrow-left-1'></i>",
"next": "<i class='flaticon-arrow-right'></i>"
},
"info": "Showing page _PAGE_ of _PAGES_"
}
});
// 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( {
"scrollY": "283px",
"paging": false
} );
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} );