javascript - extjs4 主题树面板

标签 javascript css extjs4

我正在尝试开始为 Sencha 4 Tree 面板设置主题,更改文本大小和背景颜色等内容。 我还没有找到使用 viewConfig 或其他方式执行此操作的正确方法。 这是我目前拥有的:

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:

<div id='nav'>

</div>

CSS:

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

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

有人能指出正确的方法吗?

最佳答案

是的,出于主题目的,您可以使用相同的技巧来设置不同的 ext 对象的样式。例如,更改您可以使用的节点的文本颜色。

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

如果您想全局更改它,请不要使用#tags。 (更改应用程序中 extjs 的整个主题)。

更多样式

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

希望这会有所帮助;)

关于javascript - extjs4 主题树面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22752445/

相关文章:

javascript - 如何在第二个文本区域中获得所需的输出?

javascript - 重新排序数组以将特定元素放置在给定索引处?

javascript - 想要显示同一文件夹中其他html页面中一个html页面的图像数量

javascript - ExtJs 4,如何防止xtype : 'combo' from collapsing when already selected item clicked?

extjs - 在下一个按钮上设置自动对焦

javascript - 为什么数组是空的

javascript - 在 Javascript 字符串中显示 HTML 代码

php - 仅显示部分文件缩略图

javascript - 新类(class)保留旧类(class)行为

select - extjs 4 树通过其内部 id(而不是通过记录索引)选择特定节点