我们在我们的应用程序中使用treepanel。代码是:
var exStore = Ext.create('Ext.data.TreeStore',{
root : {
children : [{
text : 'Parent 1',
id : 'parent1',
checked : false,
iconCls : 'ico1',
children : [{
text : 'Child 1',
id : 'child1',
checked : false,
leaf : true
},{
text : 'Child 2',
id : 'child2',
checked : false,
leaf : true
}]
},{
text : 'Parent 2',
id : 'parent2',
checked : false,
iconCls : 'ico2',
children :[{
text : 'Child 3',
id : 'child3',
checked : false,
leaf : true
},{
text : 'Child 4',
id : 'child4',
checked : false,
leaf : true
}]
}]
}
});
var treepanel = Ext.create('Ext.tree.Panel',{
id : 'tree',
width : 300,
height : 300,
store : exStore,
rootVisible : false
});
但我们在这里面临两个问题。
1.我们为父节点指定了iconCls。当树折叠时它显示正常。如果我们展开树,它会被文件夹图标替换。参考请看附图。
2.如果我们选择父节点,那么特定父节点下的子节点必须被选中。
如果有人有想法。请帮助我。我们在这些问题上做了很多尝试。