【问题标题】:How to highlight a row depending on the cell value如何根据单元格值突出显示一行
【发布时间】:2018-11-18 09:34:00
【问题描述】:

我正在尝试代码:

{title:"Age", field:"age", align:"left", 
 formatter:function(cell, formatterParams){
            var value = cell.getValue();
            if(value > 20){
                cell.getRow().getElement().css({    
                    "background-color": "#ffbe33"
                });
                return value;
            }else{
                cell.getRow().getElement().css({    
                    "background-color": "transparent"
                });
            return value;
    }}
    }

但是得到一个错误: TypeError: cell.getRow(...).getElement(...).css 不是函数

【问题讨论】:

    标签: tabulator


    【解决方案1】:

    如果您使用的是 Tabulator 4.0 或更高版本,它会从 getElement 函数返回一个 DOM 节点,因此您需要使用 .styles em> 属性:

     cell.getRow().getElement().style.backgroundColor = "#ffbe33";
    

    【讨论】:

      猜你喜欢
      • 2023-04-10
      • 2015-09-13
      • 1970-01-01
      • 1970-01-01
      • 2022-10-23
      • 1970-01-01
      • 1970-01-01
      • 2018-01-04
      • 2021-07-03
      相关资源
      最近更新 更多