Complex headers (rowspan and colspan) Using JSON

Complex headers (rowspan and colspan) Using JSON

swksswks Posts: 1Questions: 1Answers: 0

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

  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin

    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

This discussion has been closed.