From cc20c917d6b15ed4ac5c335adcd1392e8772759f Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Fri, 18 Jul 2014 13:52:29 -0400 Subject: [PATCH] Fix set cell value to handle both formulas and numbers --- jquery.sheet.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jquery.sheet.js b/jquery.sheet.js index b19602b..1f4c2f7 100644 --- a/jquery.sheet.js +++ b/jquery.sheet.js @@ -740,10 +740,16 @@ jQuery = jQuery || window.jQuery; && (cell = jS.getCell(rowIndex, colIndex, sheetIndex)) ) { try { - cell.value = value; - cell.valueOverride = cell.formula = ''; + if ((value + '').charAt(0) == '=') { + cell.valueOverride = cell.value = ''; + cell.formula = value.substring(1); + } else { + cell.value = value; + cell.valueOverride = cell.formula = ''; + } cell.calcLast = cell.calcDependenciesLast = 0; - jS.updateCellValue(sheetIndex, rowIndex, colIndex); + jS.updateCellValue.call(cell); + jS.updateCellDependencies.call(cell); return true; } catch (e) {} }