如何在文件夹结构中包含符号'+'和& ' - “分别表示扩展和压缩?在代码下方形成树,文本为链接,但我想要文件夹图片的链接?
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var children = [{
text:'First Child',
children: [{
text:'First Child Level1',
children: [{
text:'First Child Level11',
leaf:true
},{
text:'First Child Level12',
leaf:true
},{
text:'First Child Level13',
leaf:true
}]
}, {
text:'Second Child',
children: [{
text:'Second Child Level1',
leaf:true
},{
text:'Second Child Level2',
leaf:true
},{
text:'Second Child Level3',
leaf:true
}]
}]
}, {
text:'Third Child',
children: [{
text:'Third Child Level1',
leaf:true
},{
text:'Third Child Level2',
leaf:true
},{
text:'Third Child Level3',
leaf:true
}]
},{
text:'Fourth Child',
children: [{
text:'Fourth Child Level1',
leaf:true
},{
text:'Fourth Child Level2',
leaf:true
},{
text:'Fourth Child Level3',
leaf:true
}]
}];
Ext.onReady(function(){
var tree = new Ext.tree.TreePanel({
loader:new Ext.tree.TreeLoader(),
width:1000,
height:1000,
renderTo:Ext.getBody(),
root:new Ext.tree.AsyncTreeNode({
expanded:true,
leaf:false,
text:'FAMILY',
children:children
})
});
});
答案 0 :(得分:1)
我不确定是否可以使用文字文本来完成,但是如果您能够使用'+'和' - '的图标,那么您需要做的就是设置css,例如样式表中的以下内容:
.x-tree-node-collapsed .x-tree-node-icon {
background-image: url(path/to/icon/plus.gif);
}
.x-tree-node-expanded .x-tree-node-icon {
background-image: url(path/to/icon/minus.gif);
}
将使用加号/减号图标替换文件夹图标。 Sencha ExtJS Examples Site
就是一个例子