Search code examples
javascriptdatatablesyadcf

Colvis don't work for datatable with yadcf


I don't understand why colvis don't work for my table.
I include these css and js:

<link rel="stylesheet" type="text/css" href="https://datatables.net/release-datatables/extensions/ColVis/css/dataTables.colVis.css">
<script src="https://datatables.net/release-datatables/extensions/ColVis/js/dataTables.colVis.js"></script>

and then for initialisation

dom: 'C<"clear">lfrtip'

so my code is like this:

oTable = $('#example').dataTable({


        dom: 'C<"clear">lfrtip',
        "bJQueryUI": true,
        "bStateSave": true

    }).yadcf([{

But this solution don't work for my table because Colvis doesn't appear and then destroy other css/layout of table.
Here my table: MY TABLE


Solution

  • You need to read the datatables docs and understand the difference between 1.9 Hungarian notation syntax and the camelCase of 1.10

    replace dom: 'C<"clear">lfrtip', with "sDom": 'C<"clear">lfrtip',

    And include the colVis css/js in your jsfiddle

    Here is a working jsfiddle