0

我正在尝试代码:

{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 is not a function

4

1 回答 1

0

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

 cell.getRow().getElement().style.backgroundColor = "#ffbe33";
于 2018-11-22T21:41:28.720 回答