2016-05-13 58 views
0

我試圖在PHP中切換Kendo UI甘特例子的數據源。我已經將模式與返回的內容進行了映射,但我只是得到一個空白的甘特圖,其中有一個標題 - 「未定義」。Kendo UI甘特圖不處理JSON

{ 
    "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" 
    } 
} 

以上是將JSON發送回Kendo,但它不呈現。

回答

0

找到了解決方案:

I型鑄造的整數,設置父母爲空,而不是零(0),並把通過對劍道之前轉換日期,在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 
}]