HandsonTable条件格式

HandsonTable Conditional Formatting

本文关键字:格式 条件 HandsonTable      更新时间:2023-09-26

如果任何单元格值为空,我如何更改背景?这个函数只改变TD的背景,而不是整行。

function invalidRowRenderer(instance, td, row, col, prop, value, cellProperties) {
    Handsontable.renderers.TextRenderer.apply(this, arguments);
    td.style.fontWeight = 'bold';    
    td.style.background = '#A9A9A9';
}

如果您想更改整个父行的颜色,您可以这样做:

$(td).parent().style.background = '#A9A9A9';

这将把样式应用于td的父元素,也就是tr,也就是行。