自动渲染器中的自定义渲染器或条件样式

时间:2017-06-05 20:15:53

标签: css reactjs handsontable

使用官方双手反应包装器我很难弄清楚如何注册自定义渲染器,目标是渲染一些具有不同样式的行。我试图编写一个自定义渲染器并且它抛出一个错误,说渲染器没有注册,这可能是因为我试图在文档https://docs.handsontable.com/0.32.0/demo-conditional-formatting.html之后注册它,并将它附加到Handsontable

1 个答案:

答案 0 :(得分:0)

function groupingRenderer(instance, td, row, col, prop, value, 
cellProperties) {
  Handsontable.renderers.TextRenderer.apply(this, arguments);
  td.className = 'group';
}

然后在设置对象中调用该函数作为PropT传递给HotTable

cells(row, col, prop) {
    const cellProperties = {};
    if((tableData.rows[row]).total) {
      cellProperties.renderer = groupingRenderer;
    }

    return cellProperties;
  },

注意我没有注册"渲染器"相反,我直接称它为。

相关问题