【问题标题】:ag-grid: hover row style not working, when cell background overridesag-grid:当单元格背景覆盖时,悬停行样式不起作用
【发布时间】:2019-10-03 12:22:01
【问题描述】:

我在 cellstyle 的某些条件下更改单元格的背景颜色

    if(//some condition)   
    {
    //highlighted the background color
      return { 'background-color': '#8a1538', color: 'white' };
    }

//otherwise clear the highlighted color and return default colors for grid
    if (params.node.rowIndex % 2 === 0)
      return { 'background-color': '#f9f8f8', color: '#333f48' };
    else
      return { 'background-color': '#fff', color: '#333f48' };

但是在此之后,悬停功能不起作用,悬停行如何工作?

【问题讨论】:

    标签: ag-grid-angular


    【解决方案1】:

    看起来这可能会有所帮助:

      div.ag-row-hover:not(.ag-row-group) div{
        background: #52a8ff !important;
        color: white;
      }
    
      div.ag-row-hover .ag-cell-inline-editing div {
        color: black;
      }
    

    【讨论】:

      【解决方案2】:

      使用提到的 cellClassRules here

      cellClassRules: {
        "ag-red": (params) => {
          return params.value <= 100;
        },
          "ag-amber": (params) => {
          return params.value > 100 && params.value <= 200;
        },
          "ag-green": (params) => {
           return params.value > 700;
         },  
      }
      

      【讨论】:

        猜你喜欢
        • 2019-03-10
        • 2020-01-14
        • 2012-01-19
        • 1970-01-01
        • 2020-04-28
        • 2021-09-02
        • 2020-08-14
        • 2016-09-17
        • 1970-01-01
        相关资源
        最近更新 更多