DataTable init : list of "complex" object.
DataTable init : list of "complex" object.
Hi,
1) I try to pass a "complex" list of JSON object at the data source but that don't work... my table is blank and I have THIS ERROR :
Requested unknown parameter 'firstname' for row 0. For more information about this error, please see http://datatables.net/tn/4
MY JS CODE :
$('#contact-list').dataTable( {
"processing": true,
"data": datatab,
"columns": [
{ "data": "firstname" },
{ "data": "lastname" },
{ "data": "phone" },
{ "data": "address.city" },
{ "data": "relationship.name" }
]
});
2) My JSON structure :
[
{
"phone":"0600000000",
"address":{
"street":"Rue du Loup",
"city":"Bordeaux",
"zip":"33000"
},
"relationship":{
"id":"34f221c5-458c-40ec-a8a3-49b4138ee9f0",
"name":"Amis"
},
"id":"3d1f9c4e-514f-4759-93b6-f435092ce670",
"firstname":"Nico",
"lastname":"Las"
},
{
"phone":"0700000000",
................
Huum I also want the ID not be visible but only use on clic button for example.
I use console of chrome but it's really difficult to debug js... I'm a student, don't blame me :)
Can you help to solve this error ?
Replies
That looks like it should work okay. Can you please link to a test case showing the issue, or use the DataTables debugger, as per the forum rules.
Allan