Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Berus committed Apr 10, 2015
1 parent e1faedb commit 2e1f780
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/handsontable.formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@

function HandsontableFormula() {

var isFormula = function (value) {
if (value) {
if (value[0] === '=') {
return true;
}
}

return false;
};

var formulaRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
if (instance.formulasEnabled) {
if (instance.formulasEnabled && isFormula(value)) {
// translate coordinates into cellId
var cellId = instance.plugin.utils.translateCellCoords({row: row, col: col}),
prevFormula = null,
Expand Down Expand Up @@ -57,6 +67,7 @@
// parse formula
var newValue = instance.plugin.parse(formula, {row: row, col: col, id: cellId});

// check if update needed
needUpdate = (newValue.error === '#NEED_UPDATE');

// update item value and error
Expand Down

0 comments on commit 2e1f780

Please sign in to comment.