1.需求:想要實作在頁面上一次性加載整個樹結構,而不是根據一個id去查一遍資料庫
2.問題:點開一次子節點(擴展),就會去查一遍資料庫的資料,重復加載原來的資料
最后一個節點的leaf 都已經設定為true
問題圖片展示:

代碼展示:
var treeStore = Ext.create('Ext.data.TreeStore', {
fields : [{
name : 'id',
type : 'string'
}, {
name : 'name',
type : 'string'
}, {
name : 'parentId',
type : 'string'
}, {
name : 'leaf',
type : 'boolean'
}],
sorters : {
property : 'order',
direction : 'ASC'
},
autoLoad : true,
proxy : {
reader : {
type : 'json',
root : 'data'
},
type : 'ajax',
actionMethods : 'POST',
timeout : 60000,
url : eastcom.baseURL + '/cim/getCimBusinessTypeTreeList',
}
});
var treePanel = Ext.create('Ext.tree.Panel', {
width : 500,
height : 335,
store : treeStore,
autoScroll : true,
useArrows : true,
rootVisible : false,
multiSelect : false,
singleExpand : true,
listeners : {
select : function(rowModel, record, index) {
selectValue=https://bbs.csdn.net/topics/record.get('value');
selectLabel=record.get('label');
}
},
columns : [{
xtype : 'treecolumn',
text : '業務型別',
flex : 1,
sortable : true,
dataIndex : 'name'
}]
});
uj5u.com熱心網友回復:
,好久沒用過ext了,幫頂
uj5u.com熱心網友回復:
后臺回傳資料(中文亂碼了,忽略不計)
uj5u.com熱心網友回復:
怎么解決的呀,大佬?轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/214171.html
標籤:Web 開發
