我的希望是在我的視圖中獲取呈現爲樹的JSON對象。我的代碼是在一個名爲/app/view/main/Tree.js文件從JSON抓取樹
Ext.define('SGSS.view.main.Tree', {
extend: 'Ext.tree.Panel',
alias: 'viewmodel.tree',
xtype: 'SimpleTree',
width: 400,
height: 250,
store: {
root: {
expanded: true
},
proxy: {
type: 'ajax',
url: '/cgi-bin/uiconnector',
reader: {
type: 'json',
rootProperty: 'assets'
}
}
}
});
當我呼籲引用此頁面中,我得到一個屏幕,看起來比預期的稍有不同:
這只是空白文件夾,將無限期地繼續下去。不是我想到的JSON對象。任何想法我做錯了什麼?
我的JSON如下:
{
"assets": {
"batteryzone": [
{
"id": "10001",
"type": "batteryzone",
"label": "BZ1",
"parentid": "1001",
"model": "sim",
"alarmsev": "None",
"extant": "true",
"invertersonline": "0",
"hvaconline": "0",
"racksonline": "0",
"interfacerev": "0",
"plcrevision": "0",
"numbatteryracks": "20",
"dcvoltage": "0.0",
"dcpower": "0.0",
"averagesoc": "0.0",
"storedenergy": "0.0",
"startupsubstate": "0",
"startupsequence": "0",
"recoverymode": "false",
"tempmaxconnected": "-4.0",
"chargecapacity": "0",
"dischargecapacity": "0",
"dccurrent": "0.0",
"containerenabled": "false",
"hicell": "3.016",
"locell": "3.011",
"nameplateenergy": "1950",
"recoveryrunning": "false",
"currinputs": []
},
{
"id": "10002",
"type": "batteryzone",
"label": "BZ2",
"parentid": "1001",
"model": "sim",
"alarmsev": "None",
"extant": "true",
"invertersonline": "0",
"hvaconline": "0",
"racksonline": "0",
"interfacerev": "0",
"plcrevision": "0",
"numbatteryracks": "20",
"dcvoltage": "0.0",
"dcpower": "0.0",
"averagesoc": "0.0",
"storedenergy": "0.0",
"startupsubstate": "0",
"startupsequence": "0",
"recoverymode": "false",
"tempmaxconnected": "-4.0",
"chargecapacity": "0",
"dischargecapacity": "0",
"dccurrent": "0.0",
"containerenabled": "false",
"hicell": "3.016",
"locell": "3.011",
"nameplateenergy": "1950",
"recoveryrunning": "false",
"currinputs": []
}
]
}
}
我這麼想嗎? (我的意思是,顯然我是!)
我看到的第一個問題是,您的商店似乎不是定義爲TreeStore,而是定義爲標準(平面)商店。當我忘記將商店設爲樹木商店時,我不止一次地遇到了同樣的無限期遞歸問題。 – Alexander