I'm trying to change the column numbers of my Datatables after I initial the table:
where retitle is an array (i.e. an array of length 4) and c is the length of retitle (i.e. c=4), which is previously defined.
var atarget = [];
var stitle = [];
for(var i=0; i<c; i++){
atarget[i] = i;
stitle[i] = retitle[i];
}
var oTable = $('#table_id').dataTable({
"bPaginate": false,
"bProcessing": true,
"bLengthChange": true,
"bFilter": true,
"bRetrieve": true,
"bInfo": false,
"bAutoWidth": false,
"bServerSide": true,
"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"sAjaxSource": './aadata.txt',
"aoColumnDefs": [
{"sTitle":stitle,"aTargets":aTarget}
]
});
But it just doesn't work.