Each time jQuery Calx is initialized, sheet object is created for each selected element andstored in the sheet registry inside the calx object, you can retreive this sheet object usinggetSheet
method.
$('selector').calx('getSheet')
Please note, that selector should retrieve single dom element to get correct sheet object. After sheet object is retreived, you can call all the method available.
calculate
sheet.calculate()
Calculate the whole sheet and display the result in each cell.
checkCircularReference
sheet.checkCircularReference()
Checking if circular reference exist in the sheet.
evaluate
sheet.evaluate(formula)
Evaluating formula in the current sheet.
getCell
sheet.getCell(cellAddress)
Get the cell object on the specified address.
getCellValue
sheet.getCellValue(cellAddress)
get value of the cell on specified address
getCellRange
sheet.getCellRange(rangeStart, rangeStop)
Get the cells object in the range, the result will be object looks like below
{
A1: cellObject,
A2: cellObject,
...
}
getCellRangeValue
sheet.getCellRangeValue(rangeStart, rangeStop)
Get value of the cells in the range, the result will be object looks like below
{
A1: 'some value',
A2: 100
...
}
getVariable
sheet.getVariable(varName)
Get the defined variable value.
refresh
sheet.refresh()
Rebuild cell registry from the scratch.
reset
sheet.reset()
Reset the form inside sheet element to its original state.
update
sheet.update()
Update cell registry against any change in the sheet element.
Hi Ikhsan,
do you know how I can reset only some cell? (inside a fieldset, for example) not all the sheet.
Thanks in advance 🙂
Hi Andrea,
It can’t, since reset is only available for form element, but you can use the setValue method to set several cell value
Hi Ikhsan, first of all excelent API. I was working with this component and found something interesting.
In the database by default I have a formula for a specific cell but I need to change to a value due certain criteria in my web form, I used setValue and then I recalculate sheet formulas, my surprise was the values were not updated, after a while I found the reason and was because a formula exists, my solution was to empty the formula and then set the value.
I do not know if setting the a value in a cell should empty the formula by default and viceversa, I think it would be safest.
Again great job.
Hi Gustavo,
Yes, that behaviour is expected to prevent user inputting value in field that has formula in it, to set the value, you can clear the formula using
cell.setFormula('')
Best regards
Ikhsan