0
我通過加載數據創建一個ExtJS的樹動態的JS代碼如下ExtJS的樹動態加載
var treeModel = Ext.define("TreeModel", {
extend : "Ext.data.Model",
fields : [{id: "id", type : "string"},
{name : "text", type : "string"},
{name : "leaf", type : "boolean"}]
});
var store = new Ext.data.TreeStore({
model: 'treeModel',
proxy: {
type: 'ajax',
url: 'listtreecontent.action'
},
root: {
expanded: true
},
reader: {
type: 'JSON',
root: 'array'
},
autoLoad:true
});
var treePanel = new Ext.tree.TreePanel({
title: 'Data management',
width: 500,
height: 300,
renderTo: Ext.getBody(),
useArrows: true,
rootVisible: false,
store: store
});
,但它並不顯示在樹
我能得到響應數據, response data
當我將響應數據寫入一個json文件,並讓url = jsonfile地址時,它可以顯示樹,我不知道爲什麼?
你檢查你的DevTools控制檯設置了一個param?有沒有錯誤? –
我認爲這將幫助你:http://stackoverflow.com/questions/13952140/extjs-treestore-with-proxy –
我的返回是一種字符串,其中包含 {「success」:true,「children」:[ ]} 但它也不起作用。 和我也嘗試jsonobject的類型,它不起作用 – user6601527