Problem while populating dataTable with a txt file.

Problem while populating dataTable with a txt file.

delordelor Posts: 2Questions: 0Answers: 0
edited September 2013 in DataTables 1.9
Hi all,

I am working with dataTable and I am having some trouble to populating the dataTable from a txt file
I am still having the Loading message in the Table and nothing from my txt file in being displayed.

Here is the way I have tried to do:

$("#table").dataTable({
"bProcessing": true,
"sAjaxSource": "Sources/data.txt",
"aoColumns":[
{"mData":"first_name"},
{"mData":"second_name"},
{"mData":"address"},
{"mData":"birthday"}
],
"bJQueryUI":true,
"sPaginationType":"full_numbers"
});

and my data.txt file which is located to the Source folder looks like this:

[
{
"first_name": Test1,
"second_name": Test1,
"address": Test1,
"birthday": 21-09-2000
},
{
"first_name": Test2,
"second_name": Test2,
"address": Test3,
"birthday": 21-09-2000
},
{
"first_name": Test3,
"second_name": Test3,
"address": Test3,
"birthday": 21-09-2000
},
{
"first_name": Test4,
"second_name": Test4,
"address": Test4,
"birthday": 21-09-2000
}
]

How can I solve this problem?

Thanks!

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Se sAjaxDataProp to be an empty string. Otherwise it expects an object with the `aaData` property.

    Allan
  • delordelor Posts: 2Questions: 0Answers: 0
    Thank you very much, Allan!!!
This discussion has been closed.