-1

我在下面有这个页面,其中 data:piece 看起来就像来自服务器的 JSONP,但它没有显示任何具有此概念证明的数据。

稍后我希望替换数据:部分

transport : {
read : "dwr/jsonp/DemoProxy/read/arg0",
dataType : "jsonp"
},

但让我们首先让下面的页面正常工作。

<html><body>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.all.min.js"></script>
<link href="styles/kendo.common.min.css" rel="stylesheet" />
<link href="styles/kendo.default.min.css" rel="stylesheet" />
    <div id="grid0"></div>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#grid0').kendoGrid({
                dataSource : {
                    data : [ {
                        "reply" : [ {
                            "location" : "dfg", "multi" : "dfg", "name" : "dfg"
                        }, {
                            "location" : "dfg", "multi" : "dfg", "name" : "dfg"
                        } ]
                    } ],
                    schema : {
                        data : "reply",
                        model : {
                            fields : {
                                location : {
                                    type : "string"
                                },
                                multi : {
                                    type : "string"
                                },
                                name : {
                                    type : "string"
                                }
                            }
                        }
                    },
                },
                columns : [ {
                    field : "location", title : "Location"
                }, {
                    field : "multi", title : "Multi"
                }, {
                    field : "name", title : "Name"
                } ]
            });
        })
    </script>
</body></html>
4

1 回答 1

1

尝试datadataSourceas 中定义:

data  :{
    "reply":[
        { "location":"dfg", "multi":"dfg", "name":"dfg" },
        { "location":"dfg", "multi":"dfg", "name":"dfg" }
    ]
},

既然在schema你说数据在replydata是一个object而不是一个array。实际上是array什么reply

于 2012-12-07T22:02:54.110 回答