Cannot extend unknown button type: columnToggle

Cannot extend unknown button type: columnToggle

ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

I'm trying to create a columnToggle button that will hide/show the last 10 columns of my table. When I put it in my buttons array (using code from the example in the reference) I get and exception:

uncaught exception: Cannot extend unknown button type: columnToggle

I am definitely loading the button extension and its css and I see that it the js is loaded successfully in the Net tab of firebug.

Here is the buttons array (only the columnToggle button is in question here- I left the others in for completelness and to show that the button extension is working:

,buttons: [
    {
        extend: 'columnToggle',
        columns: ':gt(7)'
    },
        'selectAll',
        'selectNone',
    {
            text: 'Pref Only',
            action: function ( e, dt, node, config ) 
            {
                addtable
                .columns( 3 )
                .search( '1' )
                .draw();
            }
        },
        {
             text: 'All',
             action: function ( e, dt, node, config ) {
             addtable
                .columns( 3 )
                .search( '' )
                .draw();
             }
        }
]

Answers

  • allanallan Posts: 63,873Questions: 1Answers: 10,528 Site admin

    My guess is that you don't have the buttons.colVis.js file loaded for the page, but I'd need a test case showing the issue to be able to confirm that.

    Allan

  • ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

    I am now loading the colvis plugin from the cdn, but that didn't resolve it.
    I'll try this on a simple test page.

    What is a good way for me to send you a link to a test page that I don't want the world to see?

  • allanallan Posts: 63,873Questions: 1Answers: 10,528 Site admin

    If you can't create a page on http://live.datatables.net , JSFiddle, CodePen, etc, then you could PM me it by clicking my name above and then "Send message".

    Allan

This discussion has been closed.