How to create column spanned top header in JS model?
How to create column spanned top header in JS model?
![vorodot](https://secure.gravatar.com/avatar/ab563368bef13cacfc2800a72fc843ac/?default=https%3A%2F%2Fvanillicon.com%2Fab563368bef13cacfc2800a72fc843ac_200.png&rating=g&size=120)
Hi,
because it is hard to me to find sample but how can I extend my setup model to add one top span header over the first two columns and additional header over the third column?
I found an example but it setups the dom model instead of the JS model.
I need to start from the JS model
$("#topicsGrid").DataTable({
processing: !0,
serverSide: !0,
ajax: {
url: "/GetData"
},
scrollX: !0,
info: !0,
paging: !0,
pagingType: "simple_numbers",
columns: [{
title: "First Name",
width: "300",
visible: !0,
searchable: !1,
data: "FirstName"
}, {
title: "Last Name",
width: "300",
visible: !0,
searchable: !1,
data: "LastName"
}, {
title: "Age",
width: "300",
visible: !0,
searchable: !1,
data: "Age"
}]
}
Answers
DataTables' initialisation options do not provide a way to create a complex header (i.e.
colspan
/rowspan
). You need to create it using standard DOM methods if you need to create it using Javascript, rather than just having it in the HTML source.Allan