【问题标题】:kendoui: Uncaught ReferenceError: uid is not definedkendoui:未捕获的ReferenceError:未定义uid
【发布时间】:2012-12-10 09:25:14
【问题描述】:

在我的数据网格中,我使用 tornado 服务器从 json 中转储的数据库中读取
如果访问了 api/notes,它看起来像这样:
{"total": 0, "rows": "[]"}
(表格最初是空的,用户应该填写它......) 当然 dataSource 是:

   transport: {
      read: {
        url: '/api/notes/',
        dataType: 'json',
        type: 'GET',
      },


      parameterMap: function(options, operation) {
        var map = {};
        if (operation == 'read') {
            map.page = options.page;
            map.rows = options.take;
            map.sort = options.sort;
            if (map.sort) {
              map.sort = map.sort[0];
              if (map.sort) {
                var t = map.sort;
                map.sort = t.field;
                map.order = t.dir;
              }
            }

在页面加载时我得到 Uncaught ReferenceError: uid is not defined

铬转储:

Uncaught ReferenceError: uid is not defined
(anonymous function)
h.extend._rowsHtmlkendo.web.min.js:10
h.extend.refreshkendo.web.min.js:10
e.extend.proxy.gjquery.min.js:2
B.extend.triggerkendo.web.min.js:10
o.extend._processkendo.web.min.js:10
o.extend.successkendo.web.min.js:10
e.extend.proxy.gjquery.min.js:2
p.extend.read.c.successkendo.web.min.js:10
f.Callbacks.njquery.min.js:2
f.Callbacks.o.fireWithjquery.min.js:2
wjquery.min.js:4
f.support.ajax.f.ajaxTransport.send.djquery.min.js:4

【问题讨论】:

    标签: json datagrid kendo-ui


    【解决方案1】:

    尝试设置数据源的schema

    schema: {
      total: "total",
      data: "rows"
    }
    

    【讨论】:

    • 然后您可以尝试使用 jsbin.com 或 jsfiddle.net 创建一个现场演示。
    【解决方案2】:

    问题是我给客户端提供了未解析的 json
    在 json.loads() 中包装数据就可以了

    【讨论】:

      猜你喜欢
      • 2023-01-23
      • 2016-11-03
      • 2011-01-05
      • 2016-01-02
      • 2013-10-06
      • 2016-12-17
      • 1970-01-01
      相关资源
      最近更新 更多