Datatable with declared JSON array
Datatable with declared JSON array
ureshkuruhuri
Posts: 12Questions: 1Answers: 0
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
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
This discussion has been closed.
Replies