Buttons 1.0.3 issue with columnToggle and multiple columns
Buttons 1.0.3 issue with columnToggle and multiple columns
![Dargor](https://secure.gravatar.com/avatar/02154131f69f26e9287ff8a4fcbec0bf/?default=https%3A%2F%2Fvanillicon.com%2F02154131f69f26e9287ff8a4fcbec0bf_200.png&rating=g&size=120)
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.