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'

AikiAiki Posts: 2Questions: 1Answers: 0

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

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    Answer ✓

    Instead of "Collis": "Colli.Collinr", you need "data": "Colli.Collinr", which is columns.data. Datatables doesn't know what Collis is.

    Kevin

  • AikiAiki Posts: 2Questions: 1Answers: 0

    Wow thank you :)

    can't believe it was that simple :)

This discussion has been closed.