How to initialize table from JSON

How to initialize table from JSON

jsennejsenne Posts: 1Questions: 1Answers: 0

Hi,

I'm trying to create datatable (columns and rows) from JSON string that is produced by server-side script.

I get the following error on Firefox debug: "TypeError: e[i] is undefined....jquery.dataTables.min.js Line 62"

I use JQuery Ajax -> success - funktion where I initialize the datatable using the string that server returned: $('#eventReportResultTable').dataTable( json );

My JSON is like this:

{ "data": [ { "0": "1", "1": "01.04.2014 12:23", "2": "djk34kll", "3": "JKL123", "4": "Access granted", "5": "Somename" }, { "0": "2", "1": "01.04.2014 13:18", "2": "djk34kll", "3": "JKL999", "4": "Access granted", "5": "Somename 2" } ], "order": [0, "asc"], "columnDefs": [ { "targets": "0", "title": "ID" }, { "targets": "1", "title": "Time" }, { "targets": "2", "title": "Device" }, { "targets": "3", "title": "Useid" }, { "targets": "4", "title": "Event" }, { "targets": "5", "title": "Person" } ] }

I'm using DataTables version 1.10.2

thanks

This discussion has been closed.