如何包含带有符号'+‘和’-‘的文件夹结构,分别表示扩展和压缩?下面的代码形成了以文本作为链接的树,但我想要文件夹图片的链接?
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
})
});
});
发布于 2011-02-28 00:07:44
我不确定文字文本是否可以做到这一点,但是如果你能够使用'+‘和'-’的图标,你所需要做的就是设置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上有一个这样的例子
https://stackoverflow.com/questions/5079994
复制相似问题