Count only visible columns

Count only visible columns

typhontyphon Posts: 25Questions: 7Answers: 0

Hello,

is it possible to count only visible columns?

With

table.columns().header().length;

counts all columns also the hidden.

Thx for response!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,563Questions: 26Answers: 4,995
    Answer ✓

    You can get an array of true/false with table.columns().visible() then count the number of true in a loop. Example: [false, true, true, true, true, true, true].

    Kevin

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    Another option is to use the columns-selector option to select only visible columns:

    table.columns(':visible').count();
    

    Allan

This discussion has been closed.