我试图创建一个使用使用JSON数据源的jQuery /数据表的表。 我已经验证了这是很好的数据。 不幸的是,我不断收到此错误:“数据表警告(表ID =‘示例’):请求的未知参数‘1’从0行的数据源”。 我不知道我在做什么错在这里:
JSON
dataSet = [
{
"Month": "October",
"Notices Received": "0",
"Declined Participation": "0",
"Selected Field Reviews": "0",
"Selected File Review": "0",
"Pending": "0",
"Pending Previous Year": "0",
"Controversial": "0",
"GFP Reviews": "0",
"NAD Appeals": "0",
"Mediation Cases": "0",
"Monthly Cost Savings": "$0.00",
"Monthly Expenditure": "$0.00"
},
{
"Month": "November",
"Notices Received": "0",
"Declined Participation": "0",
"Selected Field Reviews": "0",
"Selected File Review": "0",
"Pending": "0",
"Pending Previous Year": "0",
"Controversial": "0",
"GFP Reviews": "0",
"NAD Appeals": "0",
"Mediation Cases": "0",
"Monthly Cost Savings": "$0.00",
"Monthly Expenditure": "$0.00"
},
{
"Month": "December",
"Notices Received": "0",
"Declined Participation": "0",
"Selected Field Reviews": "0",
"Selected File Review": "0",
"Pending": "0",
"Pending Previous Year": "0",
"Controversial": "0",
"GFP Reviews": "0",
"NAD Appeals": "0",
"Mediation Cases": "0",
"Monthly Cost Savings": "$0.00",
"Monthly Expenditure": "$0.00"
}];
JS:
$('#theJson').text(dataSet); //just for testing
$('#example').dataTable( {
"aaData": dataSet,
"aoColumns": [
{ "sTitle": "Month" },
{ "sTitle": "Notices Received" },
{ "sTitle": "Declined Participation" },
{ "sTitle": "Selected Field Reviews"},
{ "sTitle": "Selected File Reviews"},
{ "sTitle": "Pending"},
{ "sTitle": "Pending Previous Year"},
{ "sTitle": "Controversial"},
{ "sTitle": "GFP Reviews"},
{ "sTitle": "NAD Appeals"},
{ "sTitle": "Mediation Cases"},
{ "sTitle": "Monthly Cost Savings"},
{ "sTitle": "Monthly Expenditure"}
]
} );
HTML:
<table width="100%" id="example" border="0" cellspacing="0" cellpadding="0"></table>
我得到的是错误信息和表头。 页脚竟表示:“显示1到4,008 10项”,这可能表明,它正在看的数据。 谢谢!