简体   繁体   English

ExtJS —单元格背景色隐藏脏标志

[英]ExtJS — cell background color hides dirty flag

I have an editable grid. 我有一个可编辑的网格。 When a column is edited, I show the dirty flag and change the cells background-color. 编辑列时,我显示脏标志并更改单元格的背景色。 For this I have updated the CSS class: 为此,我更新了CSS类:

.x-grid-dirty-cell {
    background-image: url(../images/grid/dirty.gif) no-repeat 0 0 !important;
    background-color:#ffff4d !important;
}

This works fine. 这很好。 However, when I change the background color for the whole row the dirty flag no longer shows: 但是,当我更改整行的背景颜色时,脏标志将不再显示:

,viewConfig: {
    getRowClass: function(record_){
      if(record_.COPIED){
        return "row-highlight";
      } 
    }
  }

CSS: CSS:

.row-highlight .x-grid-cell{
    background-color:#ffff4d !important;        
}

So what attributes do I need to add to the row-highlight class so the dirty flag doesnt get hidden? 那么,我需要将哪些属性添加到row-highlight类中,以使脏标志不会被隐藏?

thanks 谢谢

A couple of things 几件事

1 - background-image: url(../images/grid/dirty.gif) no-repeat 0 0 !important; 1- background-image: url(../images/grid/dirty.gif) no-repeat 0 0 !important; is not a valid syntax, you are getting it confused with the background property. 不是有效的语法,您会将其与background属性混淆。

2 - Do not add !important to .row-highlight .x-grid-cell this will make it impossible for less restrictive selectors to replace the cell background color. 2-不要在.row-highlight .x-grid-cell添加!important,这将使限制较少的选择器无法替换单元格背景色。

Your CSS should look like 您的CSS应该看起来像

.row-highlight .x-grid-cell {
    background-color: #ffff4d;
}
.x-grid-dirty-cell {
    background: url(../images/grid/dirty.gif) no-repeat left center !important;
}

Check this fiddle: https://fiddle.sencha.com/#fiddle/1251 Edit the name "Bart" to see the dirty flag CSS 检查此提琴: https : //fiddle.sencha.com/#fiddle/1251编辑名称“ Bart”以查看脏标志CSS

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

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