未捕获的对象错误Kendo grid read issue

时间:2014-08-06 06:41:12

标签: javascript kendo-ui kendo-grid kendo-datasource

我是剑道新手。

我试图使用来自远程链接的数据创建一个Kendo网格

我的代码:

var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "http://www.mocky.io/v2/53e1cd17aaabaeaa0bc9a8f9",
            dataType: "jsonp",
            //contentType: "application/json; charset=utf-8",
        }
    }
});

$("#grid").kendoGrid({
    dataSource: dataSource,
    pageable: true,
    height: 550,
    editable: "inline"
});

远程链接返回的位置

[{"metaId":1,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"},...]

我收到错误

Uncaught object 

为什么我收到此错误?怎么解决?

CodePen

更新

Kendo在阅读时的示例电话

http://www.mocky.io/v2/53e1cd17aaabaeaa0bc9a8f9?callback=jQuery191038502124254591763_1407308470150&_=1407308470151

回复

jQuery191038502124254591763_1407308470150([{"metaId":1,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"},{"metaId":2,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"},{"metaId":3,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"},{"metaId":4,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"},{"metaId":5,"7":"A","3":"B","10":"C","18":"D","9":"E","5":"F","2":"G","27":"A","1":"AB","6":"AD","4":"AK","20":"AL"}]);

1 个答案:

答案 0 :(得分:1)

问题是字段(列)不能是数字。这是因为在内部,如果您有一个名为1的列,则会生成无效的代码data.1。将列名更改为有效的JavaScript字段名称,它将起作用。