Get Precedents

SpreadJS provides extensive support for formula auditing by providing users the ability to display relationships between formulas and cells. This can be done by tracing the precedent and dependent cells in the worksheet. The following sample uses the getPrecedents method to get the precedent cellRange information object for an array of cells. In this example, click on either cell D7 or F7 to see it's precedent cells in the Formula Tree below the SpreadJS instance.

Precedents are cells or ranges that affect the current cell's formula. Set formula =SUM(A1) in cell B1. Cell A1 is the precedent cell of cell B1. Use the getPrecedents method to get the precedent cellRange information object array of cell. As shown in the following code.
window.onload = function (){ initFunction(); } function