Problem with uninitialized col.bVisible in jquery.dataTables.js

Problem with uninitialized col.bVisible in jquery.dataTables.js

lrojas12345lrojas12345 Posts: 3Questions: 1Answers: 0

I'm hoping that someone can help me with this. I looked through the forum but could not find a reference to the exact problem.

I using DataTables version 1.10.11 and Buttons 1.1.2 and trying to use the column groups example listed here:

https://datatables.net/extensions/buttons/examples/column_visibility/columnGroups.html

and I downloaded all of the JS and CSS used in the examples, but I keep getting this error:

Uncaught TypeError: Cannot read property 'bVisible' of undefined__setColumnVis

@ jquery.dataTables.js:8427(anonymous function)

@ jquery.dataTables.js:8531$.extend.iterator

@ jquery.dataTables.js:6972(anonymous function)

@ jquery.dataTables.js:8527(anonymous function)

@ jquery.dataTables.js:7105$.extend.colvisGroup.action

@ buttons.colVis.js:185action

@ dataTables.buttons.js:574(anonymous function)

@ dataTables.buttons.js:589jQuery.event.dispatch

@ jquery-2.2.0.js:4732elemData.handle

@ jquery-2.2.0.js:4544

When I look at the line in jquery.dataTables.js, it looks like this:

            // Set
    // No change
    if ( col.bVisible === vis ) {
        return;
    }

any ideas?

Answers

  • lrojas12345lrojas12345 Posts: 3Questions: 1Answers: 0

    here is a snippet of my JS code:

    ...

    $(document).ready(function() {

        var table = $('#example').DataTable( {
        select: true,
        deferRender: true,
        dom: 'Bfrtip',
        buttons: [
            {
                extend: 'colvisGroup',
                text: 'Common',
                show: [ 1, 2, 3, 4, 5, 6, 11, 12, 36, 37 ],
                hide: [ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 
                        25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 ]
            },
            {
                extend: 'colvisGroup',
                text: 'Wire',
                show: [ 1, 2, 3, 4, 5, 6, 11, 12, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
                        19, 20, 21, 22, 36, 37 ],
                hide: [ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 ]
            },
            {
                extend: 'colvisGroup',
                text: 'Access ',
                show: [ 1, 2, 3, 4, 5, 6, 11, 12, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 
                        34, 35, 36, 37 ],
                hide: [ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 ]
            },
            {
                extend: 'colvisGroup',
                text: 'Show all',
                show: ':hidden'
            }
        ],
    

    ...

  • lrojas12345lrojas12345 Posts: 3Questions: 1Answers: 0

    I figured out what I was doing wrong. I was using "1" as the first column index instead of "0". That seemed to clear up the problem.

This discussion has been closed.