title: Jquery datatables does not display the column headers
body: <p>This is linked to the question <a href="https://stackoverflow.com/questions/11417072/jquery-datatables-not-showing-column-headings">here</a>. However, my case is a bit different. I would like to implement the same datatables example from the other question which is <a href="http://datatables.net/release-datatables/examples/ajax/objects.html" rel="nofollow noreferrer">here</a>. As you can see you have to pass the column names to be able to initialize the table headers like below</p>
  
  <pre><code> "columns": [
          { "data": "name" },
          { "data": "position" },
          { "data": "office" },
          { "data": "extn" },
          { "data": "start_date" },
          { "data": "salary" }
      ]
  </code></pre>
  
  <p>The problem is that I would not know the header names beforehand as they will change. I've tried initializing the column names when I get the data from ajax like below using a 3rd variable (see where it says 'pay attention to this line' but this doesn't work.</p>
  
  <pre><code>            //PAY ATTENTION TO THIS LINE
              var columnsHeaders = [];
  
  
        var ab = $('#dynamicScenarioTable').DataTable({
                "bDestroy": true,
                "dom": 'T&lt;"clear"&gt;lfrtip',
                "ajax": {
                      "type": "POST",
                      "url": "dynamicScenario.htm",
                      "data": tags,
                      "dataType": "json",
                      "dataSrc": function(json){
                            //PAY ATTENTION TO THIS LINE
                            columnsHeaders.push({"data": json.header });
                            return json.vals;
                      },
                      "error": function(exception)
                      {
                         displayMessageOnError();
                      }
                 },  
                  //PAY ATTENTION TO THIS LINE
                 "columns":  [columnsHeaders],
  
                 tableTools: tableDefaultS.tableTools
        });
  </code></pre>
  
  <p>Any ideas?</p>