DataTable issue with parsing JSON all empty rows but does show 'showing 1 of ... entries'
DataTable issue with parsing JSON all empty rows but does show 'showing 1 of ... entries'
Hi,
I have a problem with my datatable.
I have the following code:
$(document).ready(function() {
$('#example').DataTable( {
"processing": true,
"ajax": {
"url": "track.php?Klantnr=C-00312",
"dataSrc": "Collis"
},
"columns": [
{"Collis": "Colli.Collinr", "defaultContent": ""},
{"Collis": "Colli.Leverbon", "defaultContent": ""},
{"Collis": "Colli.Artikelnr", "defaultContent": ""},
{"Collis": "Colli.Artikelom", "defaultContent": ""},
{"Collis": "Colli.Vertrokken", "defaultContent": ""},
{"Collis": "Colli.Afgeleverd", "defaultContent": ""}
]
} );
} );
the problem is all my rows are empty.
but it does show the number of results it has found.
Showing 1 to 10 of 121 entries
this is the correct number of entries according to my MYSQL query linked to the JSON web service.
Does anyone have any ideas on how to fix this?
Thank you in advance!
This question has an accepted answers - jump to answer
Answers
Instead of
"Collis": "Colli.Collinr",
you need"data": "Colli.Collinr",
which iscolumns.data
. Datatables doesn't know whatCollis
is.Kevin
Wow thank you
can't believe it was that simple