Complex headers (rowspan and colspan) Using JSON
Complex headers (rowspan and colspan) Using JSON
Hi,
I'm trying to achieve complex headers like this:
https://datatables.net/examples/basic_init/complex_header.html
But I'm passing data via JSON from a Java back-end. I have something like this:
t.dataTable({
data: JSON.parse(rows),
columns: JSON.parse(headers),
select: true
});
Can anyone tell me how to structure the JSON "headers" Objects in order to achieve this effect?
At the moment headers are "Flat" in the sense that I simply pass in a json object that is a series of 1:1 mappings of data to column headers as follows:
[
{"mData":"id","sTitle":"Id"},
{"mData":"country_code","sTitle":"Country Code"},
{"mData":"title","sTitle":"Title"},
{"mData":"pubdata","sTitle":"Published Data"}
]
S
Answers
Hi,
This question has already been asked a number of times and there are other discussion threads about it you would find with the search tool at the top of the page. Example thread.
Allan