自定义渲染器未应用于 Table render handsontable

Custom renderer not applied on Table render handsontable

我有一个自定义渲染器,用于对我手上的列求和table。

这些值仅在编辑单元格时显示,但在 table 加载其初始数据时不显示。

是否有加载初始渲染的事件?还是我错误地调用了渲染器?

hot = new Handsontable(container, {
    data: data,
    colHeaders: col_headers,
    rowHeaders: row_headers,
    colWidths: 110,
    rowHeights: 30,
    startRows: row_count,
    maxRow: row_count,
    maxCols: col_headers.length,
    columns: column_types,
    cells: function(row, col, prop){
        if (row === row_count - 1) {
            this.renderer = sumRenderer;
            var cellProperties = {};
            cellProperties.readOnly = true;
        }
        return cellProperties;
    }
});

var sumRenderer = function (instance, td, row, col, prop, value) {
    var total = 0;
    for (ii = 0; ii < row; ii++) {
         total += instance.getDataAtCell(ii, col);
    };
    value = total;

    Handsontable.renderers.NumericRenderer.apply(this, arguments);
};

只需尝试将 sumRendered 声明放在 Handsontable 对象上方