Datatables why is thead needed
Datatables why is thead needed
PaulFreeWebs
Posts: 63Questions: 4Answers: 1
I have fully customized my table but without <thead> but now the datatables functions wont work , if i add the <thead> back it messes up my design but allows the functions to work, why is this?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
DataTables requires a valid HTML table, which means including a thead tag.
ok, is there a way I can use thead without it messing up my table? if you want an example i can give you one
here is an example https://jsfiddle.net/p2noyha4/ this is what its meant to look like http://prntscr.com/e4jf9y
No. As the manual states the
thead
is required.Having said that, if it is only the visual aspect you are concerned about, just make it
display: none
.Allan
in css so it be like #tableid thead {
display: none
}
?
EDIT: done wat u said now i dont see the coloumn names https://jsfiddle.net/p2noyha4/3/
You don't want "display: none".
First you need to fix your HTML: thead td should be thead tr td, probably with the use of colspan. Then you need to apply css styling to your heading as required.
ok fixed the html if i have followed what u said correctly.
https://jsfiddle.net/p2noyha4/5/ with the css, would i just add that on to .table.dataTable thead
?
since i have css that does most of the table and it might not work correctly if i add abit to that
EDIT: here look at this too https://jsfiddle.net/p2noyha4/6/ its messed up near search, and not connected to the other part
Fixed this now, thanks for the help!