I want to use DataTables with variable number of columns: the number of columns is not fixed, it is read from the server as well. There is no direct support for it in datatables. The solution I have is the following: I fetch (ajax) the columns and add them via jquery to the table. Then I fetch the rows (in a second ajax request). In order to be able to fetch different data this way, I wrap the table in a div and on refersh, I clear the whole div ((so deleting the included datatable) and build the table up from scratch.
It would be nice have some support for this kind of use.