colVis not works
colVis not works
antoniocib
Posts: 277Questions: 62Answers: 1
in ColVis
Hello, I've been trying for over an hour but I can't implement colVis in my code. I've tried a lot of libraries but nothing comes out.
This is my HTML:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jq-3.3.1/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.20/af-2.3.4/b-1.6.1/b-colvis-1.6.1/b-flash-1.6.1/b-html5-1.6.1/b-print-1.6.1/cr-1.5.2/fc-3.3.0/fh-3.1.6/kt-2.5.1/r-2.2.3/rg-1.1.1/rr-1.2.6/sc-2.0.1/sp-1.0.1/sl-1.3.1/datatables.min.css">
<link rel="stylesheet" type="text/css" href="css/pre.css">
<link rel="stylesheet" type="text/css" href="css/selectize.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.9.0/css/selectize.css">
<link rel="stylesheet" type="text/css" href="css/generator-base.css">
<link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.11.3/rg-1.1.4/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jq-3.3.1/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.20/af-2.3.4/b-1.6.1/b-colvis-1.6.1/b-flash-1.6.1/b-html5-1.6.1/b-print-1.6.1/cr-1.5.2/fc-3.3.0/fh-3.1.6/kt-2.5.1/r-2.2.3/rg-1.1.1/rr-1.2.6/sc-2.0.1/sp-1.0.1/sl-1.3.1/datatables.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script> -->
<script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/plug-ins/1.10.20/sorting/datetime-moment.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/plug-ins/1.10.19/dataRender/datetime.js"></script>
<script type="text/javascript" charset="utf-8"src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.9.0/js/standalone/selectize.js"></script>
<script type="text/javascript" charset="utf-8"src="js/selectiz.js"> </script>
<script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/table.scrivania.js"></script>
This is JS:
var table = $('#Buono').DataTable( {
dom: 'BPfrtip',
//dom: 'lfBrtip',
paging: false,
ajax: {
url: 'php/table.Buono.php',
type: 'POST',
data: function (d) {
d.startDate = $('#startDate').val();
d.endDate = $('#endDate').val();
}
},
order:[10,8],
searchPanes:{
columns:[10],
hideCount: true
},
//deferRender: true,
//colReorder: true,
colReorder: true,
buttons: [{
extend: 'colvis',
text: 'Main Columns',
columns: ':not(.noColVis):not(.extra)'
},
{
extend: 'colvis',
text: 'Extra Columns',
columns: '.extra'
}],
columns:[
{
"data": "buono.id_spedizione",
orderable:false,
searchable:false //0
},
{
"data": "buono.data_spedizione",
orderable:false,
searchable:false //1
},
Answers
Are the buttons not showing?
Do you get errors in the browser's console?
Do you have your
noColVis
andextra
classes set to the appropriate columns?Please provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I solved thanks.