简体   繁体   English

extjs4主题树面板

[英]extjs4 theming a tree panel

I'm trying to get started theming a Sencha 4 Tree panel, changing things such as text size and background colours, etc. I've yet to find the correct way to do this, using viewConfig or otherwise. 我正试图开始为Sencha 4 Tree面板设置主题,更改诸如文本大小和背景颜色之类的内容。我尚未找到使用viewConfig或其他方式执行此操作的正确方法。 Here's what I have at the moment: 这是我目前所拥有的:

JS: JS:

var store = Ext.create('Ext.data.TreeStore', {
    root: {
        expanded: true,
        children: [
            { text: "detention", leaf: true },
            { text: "homework", expanded: true, children: [
                { text: "book report", leaf: true },
                { text: "alegrbra", leaf: true}
            ] },
            { text: "buy lottery tickets", leaf: true }
        ]
    }
});

Ext.create('Ext.tree.Panel', {
    title: 'Simple Tree',
    width: 400,
    height: 250,
    store: store,
    rootVisible: false,
    renderTo: 'nav'
});

HTML: HTML:

<div id='nav'>

</div>

CSS: CSS:

#nav .x-tree-node-text  {
    font-size: 1.3em;
    background-color: #c0c0c0;
}

http://jsfiddle.net/EzLmd/1/ http://jsfiddle.net/EzLmd/1/

Can anyone point out the correct way to do this? 谁能指出正确的方法吗?

Yea, for theme purpose you can use the same trick for styling different ext objects. 是的,出于主题目的,您可以使用相同的技巧来设置不同的ext对象的样式。 eg to change the text color for the nodes you can use. 例如,更改可以使用的节点的文本颜色。

#nav .x-grid-cell-inner{
    color: #ff0000;
} 

don't use the #tags if you want to change it globally. 如果要全局更改,请不要使用#标签。 (to change the entire theme of extjs in your application). (以更改应用程序中extjs的整个主题)。

for more styling 更多样式

#nav .x-grid-cell-inner{
    color: #ff0000;
    text-decoration : line-through;
    font-size:larger;
} 

Hope this will help ;) 希望这会有所帮助;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM