我正在尝试使用dyntable将数据写入html表。其中一个标头称为Week of year。在JSON文件中,该名称也是Week of year (带有空格)。将json传递给dynatable时:
$('#week_table').dynatable({
dataset: {
records: [{"Week of year":"June 9, 2014 to June 15, 2014","a":0.0,"b":0.0,"c":0.0,"d":0.0,"e":1.0,"f":0.0},{"Week of year":"June 16, 2014 to June 22, 2014","a":0.0,"b":0.0,"c":5.0,"d":0.0,"e":16.0,"f":0.0}]
}});并绘制到html表中:
<table id="week_table">
<thead>
<th>weekOfYear</th>
<th>Week of year</th>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>f</th>
</thead>
<tbody>
</tbody>
</table>对于a到f,该表绘制得很好,但是对于weekOfYear和Week of year,该表显示为未定义。如何将json传递给包含空格的dynatable?
发布于 2014-09-26 03:50:27
这很奇怪。起初,它似乎也不适用于我,但这里有一个链接,指向您的数据的一个工作示例。希望这能有所帮助
http://jsfiddle.net/jmtw1tpr/
我变了
<th>weekOfYear</th>至
<th>week</th>https://stackoverflow.com/questions/26046428
复制相似问题