首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何包含带有符号'+‘& '-“的文件夹结构,表示扩展和压缩?

如何包含带有符号'+‘& '-“的文件夹结构,表示扩展和压缩?
EN

Stack Overflow用户
提问于 2011-02-22 23:17:32
回答 1查看 906关注 0票数 0

如何包含带有符号'+‘和’-‘的文件夹结构,分别表示扩展和压缩?下面的代码形成了以文本作为链接的树,但我想要文件夹图片的链接?

代码语言:javascript
运行
复制
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
        })
    });
});  
EN

回答 1

Stack Overflow用户

发布于 2011-02-28 00:07:44

我不确定文字文本是否可以做到这一点,但是如果你能够使用'+‘和'-’的图标,你所需要做的就是设置css,比如在你的样式表中:

代码语言:javascript
运行
复制
.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上有一个这样的例子

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5079994

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档