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

custom renderer or conditional styling in handsontable

使用官方的 handsontable react 包装器,我很难搞清楚如何注册自定义渲染器,目标是渲染一些具有不同样式的行。我试图编写一个自定义渲染器,但它抛出一个错误,指出渲染器未注册这可能是因为我试图按照文档 https://docs.handsontable.com/0.32.0/demo-conditional-formatting.html 将其附加到 Handsontable

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

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

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

    return cellProperties;
  },

注意我没有注册 "renderer" 而是直接调用它。