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=record.get('value');
selectLabel=record.get('label');
}
},
columns : [{
xtype : 'treecolumn',
text : '业务类型',
flex : 1,
sortable : true,
dataIndex : 'name'
}]
});
2 个解决方案
#1

#2
后台返回数据(中文乱码了,忽略不计)

#1

#2
后台返回数据(中文乱码了,忽略不计)
