How to hide buttons if screen size changed ?
How to hide buttons if screen size changed ?
Is it possible to hide buttons without reinitialize datatable dynamically ?
$(window).resize(function () {
if ($(window).width() < 960) {
//Hide columns and search box
} else {
//Show columns and search box
}
});
My Datatable;
var table = $("#tbProduction").DataTable({
"lengthChange": false,
"searching": true,
"ordering": true,
"info": false,
"autoWidth": false,
"stateSave": false,
"bDestroy": true,
"scrollY": "40vh",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
"aoColumns": columns,
dom: 'Bfrtip',
buttons: [
'copy', 'excel', 'pdf'
],
"columnDefs": [
{
"targets": [0],
"visible": false,
"searchable": false
}
]
});
Thanks in advance.
Best,
Answers
You can just gide the container div, that would work fine
Thanks @jLinux but buttons generated by datatable, they are not in a div.
Yeah they are, look through the dom