0
这是我的代码,与Fusion Tables的测试版一起工作(下面是Oleg帮助我的另一年的jqGrid代码的一部分):Fusion Tables v1新JSON返回与jqGrid&jsonReader不兼容
jsonReader: {
repeatitems: false,
cell: "", // the same as cell: function (obj) { return obj; }
root: "table.rows",
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.table.rows.length; }
},
,这里是从谷歌返回旧的JSON数据:
jQuery16406014587786572121_1350317794100(
{"table":
{
"cols":
["id","latitude","longitude","name","address_line_1","address_line_2","address_line_3","postcode"],
"rows":
[[1234,"55",-1.5, --etc
与谷歌新的API,在返回的JSON现在看起来是这样的:
{
"kind": "fusiontables#sqlresponse",
"columns": [
"id",
"latitude",
"longitude",
"name",
"address_line_1",
"address_line_2",
"address_line_3",
"postcode"
],
"rows": [
[
"1234",
"55",
-1.5,
"Name One",
"Road 1",
"Road 2",
"Sunderland",
"SR1 1AA"
],
它似乎没有“根”,我无法弄清楚如何让jsonReader使用这个新的JSON。我有一个谷歌周围,看看其他人是否遇到过这个问题,但只有一两个未答复的点击率。 java的。任何人都可以帮我吗?
谢谢奥列格 - 我会在晚些时候/明天检查一下 - 我已经尝试设置root:“”,但我没有尝试过把它完全抛弃出来 – JPMox
@JPMox:设置root:“”'会出错为您的数据。我删除了'root',因为你需要使用'root:“rows”'这是*默认* jqGrid的设置。我想你的主要问题是使用'repeatitems:false'这是错误的数据。正确的是* default *值'repeatitems:true'。可以忽略默认属性,因此我的答案中没有'jsonReader'中的'repeatitems'。 – Oleg