Does anyone know how to setup mulit-row Headers using the options.columns API?

Does anyone know how to setup mulit-row Headers using the options.columns API?

tomq_123tomq_123 Posts: 1Questions: 1Answers: 0
edited March 2017 in Free community support

We are currently dynamically generating our tables using the options.columns API and by setting the columns using JSON;

Example

var options = {
paging: false, // No paging
searching: false, // No searching
info: false, // Hide info on bottom
orderMulti: false, // No multi column ordering
ordering: false,
deferRender: true,
columns: [
{ "title": "First Name" },
{ "title": "Last Name" },
{ "title": "Job Title" }
],
columnDefs: [
{ "width": "20%", "targets": 0 }
]
};

I have a new requirement to do a multi-row header and I can't figure out the correct Json format so that Datatables will create the multi-row header. Does anyone know how to setup mulit-row Headers using the options.columns API?

Thanks

Answers

  • smart_sarusmart_saru Posts: 12Questions: 1Answers: 2

    Dear Admin / Allan,

    Pls provide multi row header as some invoicing application needs multiple header rows.
    I think soon will purchase the license. Its really good and cool to work on tables. Amazing work.
    Congrats & Thanks
    Saru

  • allanallan Posts: 63,873Questions: 1Answers: 10,528 Site admin

    There is no option to have the columns option setup complex headers I'm afraid (e.g. colspan and rowspan). Instead what you have to do is create the DOM structure you want for the header using standard DOM / jQuery methods before you initialise the DataTable.

    Allan

This discussion has been closed.