ColumnVisibility Control via column-Names?

ColumnVisibility Control via column-Names?

steinhagen.steffen@gmail.comsteinhagen.steffen@gmail.com Posts: 2Questions: 2Answers: 0
edited November 2016 in Free community support

Hello,

i recently updated the datatables-libraries from 1.10.2 to 1.10.12. The colVis-extension is now retired, and the column visibility is controlled by the datatables-buttons-extension. So far, so good.
Now i added colVis-Groups as Standard-Setup. (Out of 20 Columns hide 15, and show 5 certain columns).

postfixButtons: [
{
extend: 'colvisGroup',
text: 'Filter 1',
hide: [0,2,3,4,5,6,7,8,9,10,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29],
show: [1,11,12,13,15],
className: 'highLighted',
},
{
extend: 'colvisGroup',
text: 'Filter 2',
hide: [0,2,3,4,5,6,7,8,9,10,12,13,14,15,20,21,22,23,24,25,26,27,28,29],
show: [1,11,18,19,16,17],
className: 'highLighted',
},
{
extend: 'colvisRestore',
className: 'highLighted',
},
{
extend: 'colvisGroup',
show: ':hidden',
className: 'highLighted',
},
],

I decided to control the colums via the column-numbers. Now i had an issue that i reordered the columns for example i dragged column 0 one step to the right, so the columns 0 and 1 changed thier positions.

Now the Filter still hides columns 0(which former was columns 1) and shows column 1 (which was column 0). So the Frontend doesn't show the right content.

Is it possible to adress the columns by their titles, name, or classNames in the colVisGroups?

I am working on a js-fiddle to display the issue a bit more detailed.

This discussion has been closed.