错误加载JSON KendoUI网格

时间:2013-03-11 03:31:09

标签: jsp grid kendo-ui

下午好,

我在我的应用程序中进行了集成Kendo UI(JSP版本),但是我遇到了在网格上集成传输读取的问题。

网格可以正常发出请求。

返回:

 {} && {"registros":
        [
          {
            "id":251,
            "matricula":"32849923",
            "status":true,
            "dataAdmissao":1361674800000,
            "dataDesligamento":null,
            "version":0
           }
         ],
        "total":1}

但Grid无法呈现数据返回。下面是我的网格:

<kendo:grid name="grid" pageable="true" sortable="true" filterable="true" height="300">
                <kendo:grid-columns>
                    <kendo:grid-column title="Matricula" field="matricula" />
                </kendo:grid-columns>
                <kendo:dataSource pageSize="10" serverPaging="true" serverSorting="true" serverFiltering="true" serverGrouping="true">
                    <kendo:dataSource-transport>                
                        <kendo:dataSource-transport-read url="${path}funcionarios" type="GET" contentType="application/json" dataType="json" />                
                    </kendo:dataSource-transport>
                    <kendo:dataSource-schema total="total" data="registros">
                        <kendo:dataSource-schema-model>
                            <kendo:dataSource-schema-model-fields>
                                <kendo:dataSource-schema-model-field name="matricula" type="string" />
                            </kendo:dataSource-schema-model-fields>
                        </kendo:dataSource-schema-model>
                    </kendo:dataSource-schema>
                </kendo:dataSource>
            </kendo:grid>
  • 请求信息:

    • 请求
    • URL:/?qualitysoft / funcionarios取= 10安培;跳过= 0&安培;页= 1&安培;的pageSize = 10
    • 请求方法:GET状态代码:200 OK请求标题查看源
    • 接受:application / json,text / javascript, / ; Q = 0.01
    • Accept-Charset:UTF-8,*; q = 0.5 Accept-Encoding:gzip,deflate,sdch
    • 接受语言:en-US,en; q = 0.8连接:keep-alive
    • 内容类型:应用/ JSON
  • 查询字符串Parametersview sourceview URL编码:10 skip:0

    • page:1
    • 每页:10

1 个答案:

答案 0 :(得分:1)

当你说回报是:

{} && {
    "registros": [
        {
            "id":               251,
            "matricula":        "32849923",
            "status":           true,
            "dataAdmissao":     1361674800000,
            "dataDesligamento": null,
            "version":          0
        }
    ],
    "total":     1
}

您的意思是,如果您在浏览器中打开了您获得的URL吗?如果是这样,问题是这不是一个有效的JSON检索文件。如果您将其更改为:

{
    "registros": [
        {
            "id":               251,
            "matricula":        "32849923",
            "status":           true,
            "dataAdmissao":     1361674800000,
            "dataDesligamento": null,
            "version":          0
        }
    ],
    "total":     1
}

然后它有效。

相关问题