简体   繁体   English

行列选择了extjs

[英]Row column selected extjs

I need to provide a specific css for a column in a extjs grid. 我需要为extjs网格中的列提供特定的CSS。 I define this renderer function: 我定义了此渲染器功能:

render_alarm_color: function (value, metadata, record, rowIndex, colIndex, store){
        metadata.css = 'alarm-'+record.data.alarm;
        return value;
}

The css rule that are associated to that column is for example: 与该列关联的css规则例如:

.alarm-0 {color:#FFFFFF; background:#FF3D4A !important;}
.alarm-1 {background:#67FF59 !important;}    

The problem that i have is when i select a row because the background color of the selected row override the previous color. 我的问题是当我选择一行时,因为所选行的背景颜色会覆盖前一颜色。 I can define a background color specific for the column? 我可以为列定义背景颜色吗?

Any kind of help is helpful. 任何类型的帮助都是有帮助的。

You should be able to just change these lines: 您应该能够更改以下几行:

.alarm-0 {color:#FFFFFF; background:#FF3D4A !important;}
.alarm-1 {background:#67FF59 !important;}  

To

.alarm-0, .x-grid-row-selected > .alarm-0 {color:#FFFFFF; background:#FF3D4A !important;}
.alarm-1, .x-grid-row-selected > .alarm-1 {background:#67FF59 !important;}  

That should override the x-grid-row-selected class color. 那应该覆盖x-grid-row-selected类的颜色。 Here is a fiddle demo 这是一个小提琴演示

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

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