2015-07-21 99 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這是行。