Datatable with declared JSON array

Datatable with declared JSON array

ureshkuruhuriureshkuruhuri Posts: 12Questions: 1Answers: 0
edited March 2014 in DataTables 1.9
Hi,

I tried the following example with a declared json data array. The datatable is rendered without the data and showed the following error message.

[quote]DataTables warning (table id = 'tableContacts'): Requested unknown parameter '0' from the data source for row 0.[/quote]

The debugger information can be located at http://debug.datatables.net/urokux
[code]

var contactDT;

var tempJSON = {"contacts":[
{"lName":"Tester1", "fName":"Test", "midInit":"","title":"QUALITY/SALES","dept":"Sales","func":"President", "cPhone":"330-330-3300x330", "mobile":"330-330-3300", "fax":"330-330-3300", "pager":"", "email":"aaaaaaa", "webAddr":"www.google.com", "status":"A"},
{"lName":"Tester2", "fName":"Test", "midInit":"","title":"QA","dept":"Continuous Improved","func":"Technician", "cPhone":"330-330-3300", "mobile":"330-330-3300", "fax":"330-330-3300", "pager":"", "email":"bbbbbbbb", "webAddr":"www.google.com", "status":"A"}
]};


contactDT = $("#tableContacts").dataTable({
"bJQueryUI": true,
"bAutoWidth": true,
"bProcessing": true,
"bRetrieve": true,
"aaData": tempJSON["contacts"],
"aaColumns":[
{"mData" : "lName"},
{"mData" : "fName"},
{"mData" : "midInit"},
{"mData" : "title"},
{"mData" : "dept"},
{"mData" : "func"},
{"mData" : "cPhone"},
{"mData" : "mobile"},
{"mData" : "fax"},
{"mData" : "pager"},
{"mData" : "email"},
{"mData" : "webAddr"},
{"mData" : "status"}
]
});

[/code]

Can anyone please tell me what is going wrong here?

Thanks,
Uresh

Replies

  • ureshkuruhuriureshkuruhuri Posts: 12Questions: 1Answers: 0
    Found my mistake, I mistyped the aoColumns as aaColumns. Fixed it and is working now.
This discussion has been closed.