Requested unknown parameter
Requested unknown parameter
Bryon
Posts: 5Questions: 1Answers: 0
I have been battling with this for days and I can't figure it out. Please help
Error:
DataTables warning: table id=table_id - Requested unknown parameter 'password' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
Json:
[
{
"password": "MD5HASH"
},
{
"password": "MD5HASH"
},
{
"password": "MD5HASH"
},
{
"password": "MD5HASH"
},
{
"password": "MD5HASH"
},
{
"password": "MD5HASH"
}
]
Html:
<table id="table_id" class="display">
<thead>
<tr>
<th>password</th>
</tr>
</thead>
</table>
JS:
$(document).ready(function () {
$('#table_id').DataTable({
"info": true,
"processing": true,
"serverSide": true,
"ajax": {
"url": '@Url.Action("LoadResults", "Search")',
"dataSrc": ''
},
"columnDefs": [{
"defaultContent": "BOB"
}],
"columns": [{
"data": "password"
}]
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You JSON format looks ok but doesn't match the structure required for server side processing. The SSP structure is explained here:
https://datatables.net/manual/server-side
The question is do you need server side processing?
If you disable server side processing what happens?
Kevin
Can you link to a test case or use the debugger please.
Allan
Oh - remove the
serverSide
parameter from your initialisation btw. Your JSON isn't providing server-side processing parameters there.Allan
Thank you for the rapid response. You are correct I was not understanding the server side processing correctly.
After setting it to false I get the same error. However this time the info is correct, instead of NaN entries I get: Showing 1 to 10 of 17,013 entries
So it's a bit better, however, everything is simply empty.
http://live.datatables.net/yomamiro/2/edit?html,js,console,output
The best example I can get live that shows my issue. So it appears my json is not in the correct format. It is being generated by this:
JSONString = JsonConvert.SerializeObject(dataTable);
Whats the best way to generate the Json that works? I gather I am making an object when it needs to be a list?
Changing your example to use
columns.data
fromcolumns.title
fixes the example:http://live.datatables.net/yomamiro/3/edit
As Allan suggested please provide Debugger output. This way we can see the resulting JSON data.
Kevin
So I changed the query from my original post to something less sensitive and here is the Debugger output.
https://debug.datatables.net/ikeged
The JSON response looks like this:
It looks like your server code is taking a string or a JSON string and encoding that into another JSON string. I say this because all the
"
in the JSON response are escaped (\"
). This second JSON encoding is causing the problem.Kevin
Oh silly me.. I was encoding it twice. Problem solved, thank you!