Trying to understand ColVis usage
Trying to understand ColVis usage
jstemper
Posts: 15Questions: 10Answers: 0
I have a table with about 30 columns I would like to hide/display various columns. I have included all the appropriate JS and CSS files.
My Jquery code is
$('#rollupTable').DataTable({
"scrollX": true,
"colReorder": true,
buttons: ['colvis'],
select: true,
"columnDefs": [
{ "orderable": false, "targets": 0 }
],
fixedColumns: {
leftColumns: 1
}
});
How do I get the buttons to display? Do I need to add definitions or does it pic that up from the table itself?
TIA
This discussion has been closed.
Answers
There are a few things to do. This example is for Bootstrap but should give you an idea of where to start.
https://datatables.net/extensions/buttons/examples/styling/bootstrap.html
If you aren't using Bootstrap then you will need to place the Buttons using the
dom
init setting:https://datatables.net/reference/button/
Also this gives you the colvis buttons script:
https://datatables.net/download/release#Buttons
Kevin