handsontable formula returning #NEED_UPDATE

2019-08-15 07:26发布

问题:

I have a handsontable, for example:

+---+------+-------+-------+
|   |  A   |  B    |  C    | 
+---+------+-------+-------+
| 1 |  10  | 20    |  30   |
+---+------+-------+-------+
| 2 |  5   |=0.5+A3|=0.5+B3|
+---+------+-------+-------+
| 3 |=A1+A2|=B1+B2 |=C1+C2 |
+---+------+-------+-------+

when the table is loaded, B2 and C2 has value of #NEED_UPDATE instead of calculation result of its formula. how to handle this issue?

回答1:

Nevermind, I solved this. add afterRender callback:

afterRender: function(){
    this.setDataAtCell(ROW, COL, FORMULA);
}

this will automatically update all cell to the right.