How to define custom Formula like '=MAX2(D1, E1)'

Hi, I want to define custom Formula in handsontable, but I found it seems imposibble the formulaFunction regist operation is not available for method “registerOperation” in webpack_require(4) is not public. Is there any way else to regist my self formulaFunction ? tks.

Hi @shixia226
Currently this option is unavailable. You can only create a custom range (example: http://jsfiddle.net/pa7LoLq9/)

I think I have get a solution to this question.

Redefine the “afterRender” event to change the render behavior and reset the formulas cache.
Then the method “getData()” will return the calculated value and method “getSourceData()” will return the formula.

afterRenderer: function(td, row, col, prop, value, cellProperties) {
    var sourceValue = this.getSourceDataAtCell(row, col);
    if (/^=MAX2\([^\)]+\)$/i.test(sourceValue)) {
        td.innerHTML = doCalcMyFormula(sourceValue);//calc outside the handsontable here
        var cellValue = this.getPlugin("formulas").sheet.getCellAt(row, col);
            if (cellValue) {
                cellValue.setError(null);
                cellValue.setValue(value);
            }
    }
}

thank you for your time and effort to share the code.
I’ll mark it as an improvement suggestion