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

北战南征 提交于 2019-12-12 04:59:44

问题


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


回答1:


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)
    {
    ...
    }
 };


来源:https://stackoverflow.com/questions/9334690/how-to-determine-if-a-column-is-visible-or-not-on-a-jquery-datatable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!