user1006072
user1006072

Reputation: 963

How to determine if a column is visible or not on a Jquery datatable

I am using jQuery's datatable and I occasionally toggle the visiblity of some of the columns using the below code

tableId.fnSetColumnVis(0, false);

Having done that, there are some other controls on the UI that I was to toggle the visibility for. So, I need to check (Say on page load) if the column with 0 index is visible/hidden/present - whatever.

Please advise. Thanks

Upvotes: 0

Views: 2722

Answers (1)

Dany Y
Dany Y

Reputation: 7031

If you want to know if a column is visible or not you can do this :

 //options are the datatable options
 options.fnDrawCallback = function(oSettings) {
    if (oSettings.aoColumns[0].bVisible)
    {
    ...
    }
 };

Upvotes: 1

Related Questions