2015-07-21 95 views
1

如果任何单元格值为空,如何更改背景?此功能仅改变TD背景,而不是整行。HandsonTable条件格式

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

我对handsontable不熟悉,但参数'row'是对''的引用吗?在这种情况下,你可以设置其风格。如果不是,请尝试使用'td.parentNode'来访问DOM中的表格行。 –

回答

0

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

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

这将样式应用到td的父母这是tr这是行。