Requested unknown parameter / JSON / data
Requested unknown parameter / JSON / data
Hello
i'm new with this addon.
i have already my ajax call that returned me a json data
this is a console.log about data returned:
{data: "[{"clipwd_id":102122,"clipwd_idbad":"22222222","cl…clipwd_date":"2017-08-01","clipwd_pwd":"111111"}]", data1: "[{"params_id":1,"params_code":"importPWDdate","par…rtation des pwd","params_valeur":"18\/10\/2017"}]", recordsTotal: 10, recordsFiltered: 10, isError: false, …}
Alert : "success"
Origin : "MySQL"
data :
"[{"clipwd_id":102122,"clipwd_idbad":"22222222","clipwd_date":"2016-09-16","clipwd_pwd":"111111"},{"clipwd_id":101892,"clipwd_idbad":"22222222","clipwd_date":"2017-03-13","clipwd_pwd":"111111"},{"clipwd_id":102024,"clipwd_idbad":"22222222","clipwd_date":"2016-06-09","clipwd_pwd":"111111"},{"clipwd_id":100867,"clipwd_idbad":"22222222","clipwd_date":"2017-01-18","clipwd_pwd":"111111"},{"clipwd_id":103255,"clipwd_idbad":"22222222","clipwd_date":"2016-09-19","clipwd_pwd":"111111"},{"clipwd_id":101609,"clipwd_idbad":"22222222","clipwd_date":"2016-07-18","clipwd_pwd":"111111"},{"clipwd_id":102366,"clipwd_idbad":"22222222","clipwd_date":"2016-11-23","clipwd_pwd":"111111"},{"clipwd_id":102946,"clipwd_idbad":"22222222","clipwd_date":"2017-04-25","clipwd_pwd":"111111"},{"clipwd_id":102428,"clipwd_idbad":"22222222","clipwd_date":"2017-09-25","clipwd_pwd":"111111"},{"clipwd_id":102676,"clipwd_idbad":"22222222","clipwd_date":"2017-08-01","clipwd_pwd":"111111"}]"
data1 :
"[{"params_id":1,"params_code":"importPWDdate","params_description":"date de la derni\u00e8re importation des pwd","params_valeur":"18\/10\/2017"}]"
isError :false
recordsFiltered : 10
recordsTotal : 10
i'm using $().DataTable() in my sucess ajax return to load data in datatable
$('#Example').DataTable( {
"data": data['data'],
"columns": [
{ "data": "clipwd_id" },
{ "data": "clipwd_idbad" },
{ "data": "clipwd_date" },
{ "data": "clipwd_pwd" } ]
} );
but i have a error
DataTables warning: table id=Example - Requested unknown parameter 'clipwd_id' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
i add recordFiltered and recrdTotal to see but same issue
i don't see my error
when i used this code
$('#Example').DataTable( {
"data": data,
"columns": [
{ "data": "clipwd_id" },
{ "data": "clipwd_idbad" },
{ "data": "clipwd_date" },
{ "data": "clipwd_pwd" } ]
} );
i have no error but no data anyway
HTML Code:
<table id="Example" class="table display">
<thead>
<tr>
<th>ID</th>
<th>Client</th>
<th>Date</th>
<th>Password</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Client</th>
<th>Date</th>
<th>Password</th>
</tr>
</tfoot>
</table>
Thx for any answer !
This question has an accepted answers - jump to answer
Answers
Can you run your table through the debugger so I can get a trace and see exactly how it is setup.
Thanks,
Allan
i'm sorry but i don't know how to use this debugger.
i copy/paste the code in console but i have a undefined response
i paste console log to see you what my ajax call return to me; so the json structure
need i to insert this function in ajax sucess section ?
i did it
(http://debug.datatables.net/otixak)
ok i see what the problem is;
datatable doesn't see my rows correctly
datatable return to me 961 rows with 1 row = 1 character
but i use the same structure of json that examples in website..
this is the page online
debug.datatables.net/ayepof
It looks like your data is encapsulated in a string:
{data: "[{"clipwd_.......
the
"
in from of the[
indicates the data is a string not an array of object data. This page explains how to structure your data:https://datatables.net/manual/data/#Data-source-types
Kevin
Thx
i see that but i use the function json_encode from PHP
i see this page about array or object
and my php page send me a json object
i tried to create a json in a json like this:
and in my page
but the debugger send me always the same response about initialisation options
i think about this issue:
https://datatables.net/manual/data/#Data-source-types
after reading again this page, i ask:
when we "feed" the table in local (client side), we must to use array
when we use ajax with server-side call, we must to use json
my mistake was to use json to feed my table in local
no ?
ok
i convert my json returned by my php server side into a array and datatable accept and show my table