Please give me guide for generation Datatable with empty table
Please give me guide for generation Datatable with empty table
jschoi
Posts: 13Questions: 5Answers: 0
How can I generate DataTable as below,
<script>
let table = $("#targetTable").DataTable({
dom : "Bfrtip",
ajax : {
.......
},
columns : [
{data:"COLUMN1"},
{data:"COLUMN2"},
{data:"COLUMN3"},
{data:"COLUMN4"}
],
columnDefs: [
{ targets: [0], visible: false }
],
autoWidth: true,
select : true,
buttons : [
{text: "New Report",
action:(e, dt, node, config) => {
doAction("add_report")
}
}
],
searching: false
})
</script>
<body>
<table id="targetTable"></table>
</body>
As I know, it should be included <thead> information and matched with columns information.
but I don't need to match and sometimes can be un-matched in situation.
Please give guide for that.
Always thanks to DataTables.
This question has an accepted answers - jump to answer
Answers
You don't need to provide a
thead
. DataTables will create one for you if you don't have one. Usecolumns.title
to set the text for the header cells.Allan
Thank you allan
I appreciate for your advise always