Access Attribute of a column header via column?

Access Attribute of a column header via column?

dubois_jdubois_j Posts: 7Questions: 3Answers: 0

So I am looping through my columns and want to find custom attribute of the current columns header cell.
I was hoping to do something like the following, but attr() is not a function of header.

$tableSelector.columns().each( function () {   
    var column = this;
    column.header().attr("myAttribute");
});

Thanks

Answers

  • dubois_jdubois_j Posts: 7Questions: 3Answers: 0

    Found a work around, but it seems clunky

    $tableSelector.columns().each( function () {  
        var column = this;
        $("#myTableID thead tr th:nth-child(" + column.index()  + ")").each(function () {
            console.log( $(this).attr("myAttribute"));
        });       
     });
    
This discussion has been closed.