Trying to Get Some JSON Into Table - DataTables warning (table id = 'majors'): Requested unknown

Trying to Get Some JSON Into Table - DataTables warning (table id = 'majors'): Requested unknown

mparnellmparnell Posts: 10Questions: 0Answers: 0
edited November 2011 in General
I'm new to DataTables, and am getting "DataTables warning (table id = 'majors'): Requested unknown parameter '0' from the data source for row 0" and am totally confused at the moment. Any and all help is appreciated!

My JSON:

[code]
{ "Records": [ {"ProgID":"11","ProgramName":"Pre-Engineering","DegreeType":"Pre","ProgramID":"109","MajorMinorID":"109"},
{"ProgID":"12","ProgramName":"Pre-Law","DegreeType":"Pre","ProgramID":"110","MajorMinorID":"110"}, {"ProgID":"13","ProgramName":"Special
Education","DegreeType":"Major","ProgramID":"134","MajorMinorID":"134"}, {"ProgID":"14","ProgramName":"Pre-
Optometry","DegreeType":"Pre","ProgramID":"0","MajorMinorID":"0"}, {"ProgID":"15","ProgramName":"Pre-
Pharmacy","DegreeType":"Pre","ProgramID":"0","MajorMinorID":"0"}, {"ProgID":"16","ProgramName":"Pre-Physical
Therapy","DegreeType":"Pre","ProgramID":"0","MajorMinorID":"0"}, {"ProgID":"17","ProgramName":"Pre-Physician
Assistant","DegreeType":"Pre","ProgramID":"159","MajorMinorID":"0"}, {"ProgID":"18","ProgramName":"Pre-
Seminary","DegreeType":"Pre","ProgramID":"0","MajorMinorID":"0"}, {"ProgID":"19","ProgramName":"Pre-
Veterinary","DegreeType":"Pre","ProgramID":"0","MajorMinorID":"0"}, {"ProgID":"20","ProgramName":"Pre-
Med","DegreeType":"Pre","ProgramID":"111","MajorMinorID":"111"} ]}

[/code]

My HTML:

[code]






$(document).ready(function() {
$('#example').dataTable( {
"iDisplayLength": 1,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "search.asp",
"aoColums": [
{"sName": "ProgID", "mDataProp": "ProgID"},
{"sName": "ProgramName", "mDataProp": "ProgramName" },
{"sName": "DegreeType", "mDataProp": "DegreeType" },
{"sName": "ProgramID", "mDataProp": "ProgramID" },
{"sName": "MajorMinorID", "mDataProp": "MajorMinorID" }
]
} );
} );







Entries in the Degree Table:


<!-- table goes here -->




ProgID
ProgramName
DegreeType
ProgramID

MajorMinorID














[/code]

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    You would need to set http://datatables.net/ref#sAjaxDataProp to "Records" to let DataTables know where it should look for data.

    Allan
  • mparnellmparnell Posts: 10Questions: 0Answers: 0
    I've tried that, and even at one point had my JSON output script just put out aaData...weird.
  • mparnellmparnell Posts: 10Questions: 0Answers: 0
    Nevermind, I fixed it, I had a typo - columns was misspelled and I was missing a couple of length related items from the json array.
This discussion has been closed.