Buttons 1.0.3 issue with columnToggle and multiple columns

Buttons 1.0.3 issue with columnToggle and multiple columns

DargorDargor Posts: 1Questions: 1Answers: 0
edited October 2015 in Free community support

I noticed that in the documentation, columnToggle is supposed to toggle a set of columns, however only the first one is actually toggled.

Browsing the code, I saw that we had :

action: function ( e, dt, button, conf ) {
        var col = dt.column( conf.columns );

        col.visible( conf.visibility !== undefined ?
            conf.visibility :
            ! col.visible()
        );
    },

Which is the reason of the bug (dt.column only select the first column). I made a personal fix which seems ok:

action: function ( e, dt, button, conf ) {
    var colList = dt.columns( conf.columns );
        colList.every(function(){
            var col = this;

            col.visible( conf.visibility !== undefined ?
                    conf.visibility :
                    ! col.visible()
            );
        });
},

I will work on the appearance of the button later. Is my new behavior more consistent with the doc? Do you take pull request?

This discussion has been closed.