You don't - currently there is no way to dynamically add or remove columns in a DataTable I'm afraid. I'm sure a plug-in could be created which does it (and that is on my to-do list - just not yet had a chance to do it yet!). Until then you need to destroy and recreate the table.
If you anticipate adding columns, another approach you could take would be to add the several columns at init time and hide them. Then display them and add content to them as you "add" them later in your app.
This is not as flexible as dynamically adding columns, but might be a reasonable workaround for now.
Replies
Allan
This is not as flexible as dynamically adding columns, but might be a reasonable workaround for now.
[code]
$('#myTable').dataTable().fnDestroy();
[/code]
Thanks