How to hide buttons if screen size changed ?

How to hide buttons if screen size changed ?

emcelikemcelik Posts: 2Questions: 1Answers: 0
edited November 2015 in Free community support

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

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    You can just gide the container div, that would work fine

  • emcelikemcelik Posts: 2Questions: 1Answers: 0

    Thanks @jLinux but buttons generated by datatable, they are not in a div.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited November 2015

    Yeah they are, look through the dom

This discussion has been closed.