aData is undefined - can anyone help
aData is undefined - can anyone help
I downloade the DataTables and working on examples. I change script to:
$(document).ready(function() {
$('#example').dataTable( {
"sAjaxSource": "data/test.txt",
"sAjaxDataProp": "result",
"aoColumns": [
{ "result": "id" },
{ "result": "title" },
{ "result": "date" },
{ "result": "price" }
]
} );
} );
and my json file it looks like this
{
"success": 1,
"result": [
{
"id": "1",
"title": "Rezerwacja 1",
"date": 1404165600000,
"price": 450
},
{
"id": "2",
"title": "Rezerwacja 2",
"date": 1404165100000,
"price": 350
}
],
"message": "Jakiś komunikat"
}
Can anyone tell me how I get this error?
This discussion has been closed.
Answers
Some references that may help:
ajaxand nested object data. In your case you might be looking for something like (not sure if it works with the legacy datatables):I change to something like this and it's working :D
$('#example').dataTable( { "sAjaxSource": "data/test.txt", "sAjaxDataProp": "result", "columns": [ { "data": "id" }, { "data": "title" }, { "data": "date" }, { "data": "price" } ] } );But now how I can get date format not only numbers 1404165600000?
You can use
columns.renderto format the date for display.