Dynamic Header columns and data columns
Dynamic Header columns and data columns

Is it possible to dynamically add header columns and data columns using the ajax as source. I tried appending new columns in the CreatedRows and it works fine but the problem is the Header, i cannot add new header columns and the features of the datatables wont apply to the new added columns.
My Script below:
"createdRow": function ( row, data, dataIndex ) {
if (dataIndex==0){ }
cnttmp = 0;
$.each(data,function(i,v){
if(cnttmp > 2) $(row).append("<td>"+v+"</td>")
cnttmp++
});
// }
}
Data Source: "ajax":