【发布时间】:2015-02-20 15:12:10
【问题描述】:
我正在使用 Google 图表 - 表格图表。我的表突然停止显示任何数据。大约 5 到 7 天前,我最后一次工作时工作正常。该表将显示正确的列标题,但没有数据。这是从我的 AJAX 调用(使用 Google.DataTable 生成 json 的 C# 服务)返回的 json:
{
"cols": [
{
"type": "string",
"id": "Business Name",
"label": "Business Name"
},
{
"type": "string",
"id": "Location",
"label": "Location"
}
],
"rows": [
{
"c": [
{
"v": "<a href='/Advertiser/DisplayPage?advertiserId=8'>Acem Birding Tours</a>"
},
{
"v": "Cincinnati, OH"
}
]
}
]
}
我通过 json Lint 运行了这个 json,它是有效的 json。
我绘制图表/表格的 JavaScript 函数如下所示:
function createSearchResultsTable() {
var options = {
// Create some options for the displaying of the table
page: 'enable',
allowHtml: true,
width: 800,
pageSize: 20,
showRowNumber: true
};
// Get the list of guides
$.getJSON('/Home/SearchForGuide', { country: selectedCountry }, function (jsonData) {
}).success(function (jsonData) {
data = new google.visualization.DataTable(jsonData);
table = new google.visualization.Table(document.getElementById('resultsTable'));
table.draw(data, options);
}).fail(function (jqXHR, textStatus, errorThrown) {
alert('Error: ' + textStatus + ' ' + errorThrown);
});
}
就像我说的,大约 5 到 7 天前,这完全按预期工作,并且正在显示数据。现在,上面显示的同一行数据没有显示出来。谁能看出哪里出了问题?
【问题讨论】: