DataTables warning: - Requested unknown parameter 'X' for row 0, col
DataTables warning: - Requested unknown parameter 'X' for row 0, col
islamelshobokshy
Posts: 99Questions: 20Answers: 1
I'm getting this alert
DataTables warning: table id=achats_table - Requested unknown parameter 'Fournisseur' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
and my table is empty, I have no idea how to debug this. Help.
I've read that it's because my tbody and thead sizes do not match, but they do. Even tho I weridly find that Datatables creates a thead inside my tbody, I just noticed that. Any idea why would it do that?
This discussion has been closed.
Replies
The link provided in the error has troubleshooting steps:
http://datatables.net/tn/4
Try those and let us know what you find. Looks like you have object based data being returned but did not define
columns.data
.Kevin
I tried following the steps, I do have data defined
This gives me :
I don't see that in your output of columns. Maybe you can post more of your code and the data so we can see how you are building your columns, applying them to Datatables and how the data maps to the columns.
Kevin
I changed my columns to letters from A to N, it IS indeed there, I just changed the names, that isn't the problem I can't post the code/data, as there are 400K data with headers that vary, the code is quite complicated to be shared... I just thought you might have an idea about where could it be coming from. Like if I have data and mData at the same time, will Datatables be able to know by himself what is where and take the right one?
I would just use
data
.mData
is legacy and you don't need it.Basically what that error is saying is that your
columns.data
structure does not match the structure of the data you are applying. Without being able to see some real code snippets and data its hard to say what the problem is.Kevin
Columns.data looks this this :
And the data :
Each array containing :
Something like the above. Did that help?
Looks like you are using array based data, not object based. So you don'e want to use
columns.data
. This page describes the differences:https://datatables.net/manual/data/#Data-source-types
Kevin
I don't use columns.data? But I do have to tell him what my columns (headers) are, what should I do then? x)
In your Datatalbes init code are you doing something like this:
Which is applying this:
[{data: "A", mData: "A"}, {data: "B", mData: "B"}....
Here is an example with ajax and arrays:
https://datatables.net/examples/ajax/simple.html
No column definitions. Datatables uses the
thead
of the table defined in HTML for the column structure.Kevin