When only one row of data is available, why does my table show "no data in table"?
When only one row of data is available, why does my table show "no data in table"?
lpace
Posts: 12Questions: 6Answers: 0
test here: http://aomppapp.gmaom.us:8080/get_cotg_form?id=103329020220919_delivery.html
debugger code: epewiw
error: "No data available in table"
My JSON response only contains just 1 row of data but the table displays this message instead of the data.
Is the format of my data incorrect or my initialization wrong?
$('#rmas').DataTable({
"ajax":
{"url": "http://aomppapp.gmaom.us:9090/get_RMA?NAME_ID="+customerno,
},
"columns": [
{ "data": "Record.RECID" },
{ "data": "Record.QSHP" },
{ "data": "Record.PART_NO" },
{ "data": "Record.DESCRIPTION" },
],
});
This question has an accepted answers - jump to answer
Answers
This is the XHR response:
Datatalbes expects the row data to be in an array even if its in one row. See the Ajax docs for more details. The response should look more like this:
Kevin
thanks @kthorngren, changing my server program that generates the data to match your example array solved it.