Kendo网格对象不支持属性或方法“切片" [英] Kendo Grid Object doesn't support property or method 'slice'

查看:104
本文介绍了Kendo网格对象不支持属性或方法“切片"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将kendo网格绑定到WCF远程odata服务.但是,当我尝试填充网格时,我收到异常对象不支持属性或方法切片" .这是我的JavaScript代码,用于填充网格.

I am trying to bind the kendo grid to a WCF remote odata service. But when I try to populate the grid I receive the exception Object doesn't support property or method 'slice'. Here is my javascript code to populate the grid.

$("#datagrid").kendoGrid({
                dataSource: {
                    type: "json",
                    transport: {
                        read: "http://localhost:65401/sdrservice.svc/IssueLists"
                    },                    
                    pageSize: 20
                },                
                groupable: true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 3
                },
                columns: [{                  
                    field: "Issueid"                                        
                }, {
                    field: "Subject"                    
                }, {
                    field: "Description"
                }, {
                    field: "Module"                   
                }, {
                    field: "Status"
                }, {
                    field: "StartDate"
                }, {
                    field: "ClosureDate",
                    nullable: true
                }, {
                    field: "RaisedBy"
                }, {
                    field: "Duration"
                }]
            });

我的json对象就像

    {"odata.metadata":"http://localhost:65401/sdrservice.svc/$metadata#IssueLists",
"value":[{"Issueid":"512","Subject":"Crossing","Description":"a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet","Module":"ADF","Status":"Fixed","StartDate":"2013-05-14T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":828},
    {"Issueid":"474","Subject":"Point","Description":"a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet sapien urna","Module":"ADF","Status":"Open","StartDate":"2012-10-09T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":1045},
    {"Issueid":"937","Subject":"Point","Description":"a ipsum integer a nibh in quis justo maecenas rhoncus aliquam lacus morbi","Module":"TM1","Status":"Fixed","StartDate":"2013-05-31T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":811},
    {"Issueid":"226","Subject":"Point","Description":"a libero nam dui proin leo odio porttitor id consequat in consequat","Module":"DATA MINING","Status":"Open","StartDate":"2014-11-08T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":285},
    {"Issueid":"76","Subject":"Hill","Description":"a libero nam dui proin leo odio porttitor id consequat in consequat ut nulla sed","Module":"TM1","Status":"Fixed","StartDate":"2013-04-12T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":860}]}

我认为问题在于json对象,因为切片方法需要在此处为​​data.value的数组,但是如何使用它是我的问题,因为方法中的读取行直接调用服务并执行所需的任务,我无法控制它

I think the issue is with json object as slice method need array which is data.value here but how to use it is my problem as read line in method directly calls the service and perform the required task I have no control over it.

推荐答案

您需要设置dataSource的schema.data属性.

You need to set the dataSource's schema.data property.

schema: {
  data: 'value'
}

文档 http://docs.telerik .com/kendo-ui/api/javascript/data/datasource#configuration-schema.data

这篇关于Kendo网格对象不支持属性或方法“切片"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆