Skip to content

Update formula #572

@javg15

Description

@javg15

/**
* Update all related cells in the chain
*/
obj.updateFormulaChain = function(x, y, records) {
var cellId = jexcel.getColumnNameFromId([x, y]);
if (obj.formula[cellId] && obj.formula[cellId].length > 0) {

In this part of code, specifically IF, theres is this issue: I have a formula in the last row (SUM(A1:A2)), if delete the last row I should update to 0, then I set x.setValue("B1","0") but this is cycled, then I suggest this line

if (obj.formula[cellId] && obj.formula[cellId].length > 0 && obj.formula[cellId]!=cellId) {

Activity

pphod

pphod commented on Sep 12, 2019

@pphod
Contributor

Can you create a jsfiddle to illustrate better your problem, please?

javg15

javg15 commented on Sep 28, 2019

@javg15
Author

follow your example https://bossanova.uk/jexcel/v3/examples/programmatically-updates

  1. Insert a new blank row at the end of the table (point or example 4)
  2. Write the formula =B1+B2+B3+B4 in the cell->B5
  3. Delete the first row (point 7), Result=first, its not update the result (cell with formula); continue deleting the first row, when be only the row with the formula, will provoke a stack overflow
pphod

pphod commented on Oct 20, 2019

@pphod
Contributor

Your example resulted in a self-reference call. But, has been fixed in v3.5.2 (available in the master). It was included protections against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @javg15@pphod

        Issue actions

          Update formula · Issue #572 · jspreadsheet/ce