繁体   English   中英

Kendo UI Gantt图表未处理JSON

[英]Kendo UI Gantt chart not processing JSON

我试图在PHP内切换Kendo UI Gantt示例的数据源。 我已经将架构与返回的内容进行了映射,但是我只得到一个标题为“ undefined”的空白甘特图。

{
  "1": {
    "id": "1",
    "orderId": "1",
    "title": "TESTER1",
    "start": "\/new Date('2016-01-01 09:00:00')\/",
    "end": "\/new Date('2016-02-01 00:00:00')\/",
    "project": "1",
    "client": "4218",
    "parent": "0",
    "percentComplete": "10.11"
  },
  "2": {
    "id": "2",
    "orderId": "2",
    "title": "TESTER2",
    "start": "\/new Date('2016-01-03 09:00:00')\/",
    "end": "\/new Date('2016-02-01 00:00:00')\/",
    "project": "1",
    "client": "4218",
    "parent": "0",
    "percentComplete": "50.00"
  }
}

上面是发送回Kendo的JSON,但未呈现。

找到了解决方案:

我键入强制转换的整数,将父级设置为null而不是零(0),然后在进入Kendo之前在PHP层中将日期转换为毫秒。 我还删除了导致创建以下JSON的键。 这解决了我的渲染问题。

    [{
    "id": 1,
    "orderId": 1,
    "title": "TESTER1",
    "start": "\/Date(1463126400000)\/",
    "end": "\/Date(1463958000000)\/",
    "project": 1,
    "client": 4218,
    "parent": null,
    "percentComplete": 10
}, {
    "id": 2,
    "orderId": 2,
    "title": "TESTER2",
    "start": "\/Date(1463990400000)\/",
    "end": "\/Date(1464130800000)\/",
    "project": 1,
    "client": 4218,
    "parent": null,
    "percentComplete": 50
}]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM