如何根据单元格值突出显示行

How to highlight a row depending on the cell value

我正在尝试代码:

{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;
    }}
    }

但是报错: 类型错误:cell.getRow(...).getElement(...).css 不是函数

如果您使用的是 Tabulator 4.0 或更高版本,它 returns 来自 getElement 函数的 DOM 节点所以你需要使用 .styles 属性:

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