如何在Extjs中更改Treepanel中的访问节点颜色,就像我们在html中一样 [英] How to change visited node color in Treepanel in Extjs like we have in html

查看:498
本文介绍了如何在Extjs中更改Treepanel中的访问节点颜色,就像我们在html中一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在树面板中更改访问节点的颜色。我可以改变所选节点的颜色和样式,并使用belw进行鼠标悬停CSS:.x-grid-cell-inner-treecolumn:hover {}



.x-grid-row-selected .x-grid-cell-inner-treecolumn



任何一个请帮助我如何更改访问的节点颜色,就像我们在html链接。
对此的任何想法都将非常感激。
提前感谢帮助。

解决方案

我可以给你一个想法,但没有最终的实现。 p>

您需要的是商店中的一个额外的布尔字段,它存储该节点是否已被访问过:

  name:hasBeenVisited,
type:bool,
defaultValue:false,
persist:false

在网格中,您需要 RowModel 选择模型,并且必须绑定到选择事件的选择模型,并告诉它已被访问的记录:

  select:function(selModel,record){
record.set(hasBeenVisited,true);
}

在网格中,您添加一个getRowClass函数:

  viewConfig:{
getRowClass:function(record){
return record.get(hasBeenVisited)?hasBeenVisitedCls ;
}
}

然后你必须添加到你的CSS一个特殊的颜色:

  .hasBeenVisitedCls .x-grid-cell-inner-treecolumn {
color:purple
}


I am trying to change the color of visited node in Tree panel. I ma able to change the color and style of selected node and on doing mouse hover using belw CSS: .x-grid-cell-inner-treecolumn:hover { }

.x-grid-row-selected .x-grid-cell-inner-treecolumn

Can any one please help me how to change visited node color like we have in html link. Any thoughts on this would be higly appreciated. Thanks in advance for the help.

解决方案

I can give you an idea, but no final implementation.

What you need is an additional boolean field in the store, which stores whether the node has been visited or not:

name:"hasBeenVisited",
type:"bool",
defaultValue:false,
persist:false

In the grid, you need the RowModel selection model and have to bind to the select event of that selection model and tell the record that it has been visited:

select:function(selModel, record) {
    record.set("hasBeenVisited",true);
}

In the grid, you add a getRowClass function:

viewConfig:{
    getRowClass:function(record) {
        return record.get("hasBeenVisited")?"hasBeenVisitedCls":"";
    }
}

and then you have to add to your CSS a special color:

.hasBeenVisitedCls .x-grid-cell-inner-treecolumn {
    color:purple
}

这篇关于如何在Extjs中更改Treepanel中的访问节点颜色,就像我们在html中一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆