How to uncheck columns in "show / hide columns" button list.

How to uncheck columns in "show / hide columns" button list.

TaffmanTaffman Posts: 2Questions: 1Answers: 0
edited June 2015 in Free community support

Hi I'm new to Datatables so please excuse the following dumb question. I'm using the following table initialisation:

$(document).ready(function() {
    var t = $('#example').DataTable( {
       "dom": 'C<"clear">lfrtip',
       colVis: { exclude: [ 0,1,3 ] },
       "paging": false,
       "responsive": false,
        "columnDefs": [ {
            "searchable": false,
            "orderable": false,
            "targets": 0
        } ],
        "order": [[ 3, 'desc' ]]
    } );
    t.on( 'order.dt search.dt', function () {
        t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    } ).draw();
} );

This gives me a table which datatables calculates the column number, and recalculates the column number on re-order and/or search. I have also turned off paging and am displaying the ColVis "show / hide columns" button. What I now want to do is uncheck a couple of columns in the "show / hide columns" button list but so far have been unsuccessful, can anyone tell me how I add this?

Answers

  • TaffmanTaffman Posts: 2Questions: 1Answers: 0
    edited June 2015

    It seems that the following columnDefs cannot co-exist?

    "orderable": false, "targets": [0,1,2,10,11,12,13],
    "visible": false, targets: [10,11,12,13]
    

    Anyone have any idea why?

This discussion has been closed.