Hide column initComplete first row colspan="8"
Hide column initComplete first row colspan="8"

in DataTables 2
I am showing and hiding columns on within initComplete.
this.api().columns([6,7]).visible(false).columns([9,11]).visible(true)
However the first row always includes an additional class colspan="8"
If I add .draw() it works okay however this is server side so I get an another call to the server which I'm trying to avoid.
This table includes Editor
Anyone else seen this ?
Thanks
Answers
Datatables doesn't support
colspan
in thetbody
. See the HTML requirements for more details.Are you using the RowGroup extension which, depending on configuration, will insert rows into the
tbody
at the top of each group. Something like this example.Please post your relevant Datatables code so we can get an idea of what you have.
Better is a link to a test case showing the first row with
colspan="8"
?https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I'm not using row group and I do not have colspan anywhere in my js or html code. This is being added to the first row in the table after the initialisation when I show and hide cols. If I redraw .draw() the table during the initComplete I do not get the problem.
Thanks, Here is the code
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
The
dtr-control
class comes from Responsive. Looking at this example there is nocolspan
assigned to the cell containing the responsive control.Does the
colspan="8"
appear in the first column of all rows or just he first?Instead of using
initComplete
to set column visibility I would look at usingcolumnDefs
to set the visibility using a variable. Something like this:I believe the
Will need to be first in the array to take precedence.
Unless @allan has an answer we will probably need to see a test case showing the
colspan="8"
in the first column.Kevin
Yup, please link to a test case showing the issue so we can see what is happening and be able to debug it.
Thanks,
Allan
colspan="8" only appears on first row. I'm using initComplete because the table is on a page where the table layout is conditional on load. I have tried all options from setting all definitions to true some to true and false etc. I will try and sort a test case. Thanks