【问题标题】:HandsonTable Conditional FormattingHandsonTable 条件格式
【发布时间】:2015-10-11 01:09:17
【问题描述】:

如果任何单元格值为空,我该如何更改背景?该功能只改变TD背景,不改变整行。

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

【问题讨论】:

  • 我不熟悉handsontable,但是参数row是对<tr>的引用吗?在这种情况下,您可能可以设置其样式。如果没有,请尝试使用td.parentNode 访问 DOM 中的表格行。

标签: javascript formatting conditional handsontable


【解决方案1】:

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

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

这会将样式应用于td 的父级,即tr,即行。

【讨论】:

    猜你喜欢
    • 2015-08-06
    • 2018-04-11
    • 2017-06-28
    • 2017-03-01
    • 2020-09-22
    • 2017-11-06
    • 2016-09-20
    • 2018-02-17
    相关资源
    最近更新 更多