How do I set two dynamic header rows in jquery datatable ??
function updateTable(params) {
$.getJSON(
window.location.pathname,
params,
function(result) {
// Set table title
$('#title_box').text(result.title);
// Set table headers
var column_titles = result.column_titles1.map(function(header) {
return {
'title': header
};
});
// Let datatables render the rest.
$('#datatable').dataTable({
"ordering": false,
"searching": false,
"paging": false,
"info": false,
"columns": column_titles,
"data": table.data
});
}
);}}
with this I was able to set only one dynamic header. I need to set two header rows from the data that I return from ajax response. I've separated the the two columns as:
{"column_titles1":[["value1"],["value2"]], "columns_titles2": [["value1"],["value2"]]}