Column selectors - how to code this?

Column selectors - how to code this?

tangerinetangerine Posts: 3,365Questions: 39Answers: 395

I need to establish whether column(0) has the class '.dtr-control'.
I have this (returning an array), but then I'm stuck:

// Is the table using Responsive...?
var cols = oTable.columns('.dtr-control'); 

FWIW, I couldn't figure out jQuery hasClass either. Dumb day here.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,182Questions: 26Answers: 4,925
    Answer ✓

    Use column().header() to get the th. Put that in a jQuery call with .hasClass(), something like this:

    $( oTable.column( 0 ).header() ).hasClass( 'dtr-control' );
    

    Kevin

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited January 2022

    Sublime. Thank you so much, Kevin.

Sign In or Register to comment.