handsontable / handsontable/hyperformula
[Bug]: moveColumns and setColumnOrder update relative cell references differently
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
Behavior
HyperFormula.moveColumns updates formulas with relative cell references to use the new column addresses.
Demo: https://codesandbox.io/p/sandbox/hyperformula-movecolumns-relative-references-7zlvyz
HyperFormula.setColumnOrder does not update formulas with relative cell references.
Demo: https://codesandbox.io/p/sandbox/hyperformula-setcolumnorder-relative-references-3n7y35
Expectation
I would expect HyperFormula.setColumnOrder to update formulas with relative cell references to match the behavior of HyperFormula.moveColumns.
My understanding is that HyperFormula.setColumnOrder should behave identically to multiple, equivalent calls to HyperFormula.moveColumns.
For example:
const engine = HyperFormula.buildFromSheets({
Sheet1: [["A", "B", "C", "D"]],
});
engine.setColumnOrder(0, [2, 3, 0, 1]);
// [[ "C", "D", "A", "B" ]]
console.log(engine.getSheetSerialized(0));
should always behave equivalently to
const engine = HyperFormula.buildFromSheets({
Sheet1: [["A", "B", "C", "D"]],
});
engine.moveColumns(0, 0, 1, 4);
engine.moveColumns(0, 0, 1, 4);
// [[ "C", "D", "A", "B" ]]
console.log(engine.getSheetSerialized(0));
If this is not the intended behavior, could you please provide a recommendation for how to move multiple columns simultaneously such that formulas with relative cell references are updated.
Video or screenshots
No response
Demo
See description (multiple demos provided)
HyperFormula version
3.0.0
Your framework
No response
Your environment
Ubuntu 24.04.2 LTS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two CodeSandbox demos and compare the public setColumnOrder and moveColumns entry points, especially how relative references behave after reordering. Done means setColumnOrder updates relative cell references consistently with equivalent moveColumns calls, with the demonstrated cases covered by regression tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100