bug - not recalculating formulas using the values of new included rows
Hi, my code has in the last row a totalizer using a SUM formula for de prices, and when i added a new row and put the new price, this formula is not updated. But, when i change the value of another pre existing row, the formula is recalculated and, if i change the value of the row that i have inserted early, the formula is recalculated correctly. I think that means like is missing a refresh on the formula after insert the values of a new row.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://bossanova.uk/jspreadsheet/v4/jexcel.js"></script>
<script src="https://jsuites.net/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css">
<link rel="stylesheet" href="https://bossanova.uk/jspreadsheet/v4/jexcel.css" type="text/css">
</head>
<body>
<div id="spreadsheet"></div>
<button id="add_row">INSERT ROW BEFORE SECOND ROW</button>
<script>
var data = [
[ 'Jazz', 'Honda', '2019-02-12', '', true, '$ 2.000,00', '#777700'],
['Civic', 'Honda', '2018-07-11', '', true, '$ 4.000,01', '#007777'],
['Total', '', '', '', '', '=SUM(F1:F2)', '']
];
var sample_table = jexcel(document.getElementById('spreadsheet'), {
data:data,
columns: [
{ type: 'text', title:'Car', width:120 },
{ type: 'dropdown', title:'Make', width:200, source:[ "Alfa Romeo", "Audi", "Bmw" ] },
{ type: 'calendar', title:'Available', width:200 },
{ type: 'image', title:'Photo', width:120 },
{ type: 'checkbox', title:'Stock', width:80 },
{ type: 'numeric', title:'Price', width:100, mask:'$ #.##,00', decimal:',' },
{ type: 'color', width:100, render:'square', }
]
});
document.getElementById('add_row').onclick=function() {
sample_table.insertRow(1,1,true);
};
</script>
</body>
</html>
I inserted the row of 'Subaru' and the value of the formula keeps the same:
I change the price of the row 'Civic' and the value of the formula was recalculated:
Then when i change the value of the row 'Subaru', the formula was recalculated including this row
Are there any way to force a formula recalculation/refresh on event oninsertedrow?
Your example using JSS Pro + Formula Pro extension. https://jsfiddle.net/spreadsheet/hzc3r01o/