title: Hide column in jQuery dataTables?
body: <p>I want to hide a column in <code>jQuery DataTables</code> that contains <strong>Geo Zone</strong> in its <code>th</code>. This is what I am doing :</p>
  
  <pre><code>$(document).ready(function(){
  
          if(geo_zone_on_off==0){
              var _index=$("#datatable_ajax .heading th:contains(GeoZone)").index();
              var oTable=$("#datatable_ajax").DataTable();
              if(_index != -1){
                   oTable.column(_index).visible(false);
       }
          }
      });
  </code></pre>
  
  <p>The dataTable is loaded but the column does not get hidden. 
  Before doing this I tried to hide it when the table was rendered and it worked fine. What I did then was:</p>
  
  <pre><code> "initComplete": function(settings, json) {
                         if(geo_zone_on_off==0){
                          var _index=$("th.sorting:contains(GeoZone),th.no-sort:contains(GeoZone)").index();
  
                             if(_index != -1){
                               grid.getDataTable().column(_index).visible(false);
                             }
                         }
                         },
  </code></pre>
  
  <p>But it had a problem that it displayed the hidden columns when the table was loading. In order to avoid that issue I used the solution mentioned first. But it is not working although I am getting the index right. It does not give any error.</p>