fin-hypergrid / fin-hypergrid/core
setValue method of Hypergrid failing with TypeError: Cannot read property 'subgrid' of undefined
- Dominant language
- JavaScript
- Stars
- 907
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
When I use these two lines in my code then I get an error: TypeError: Cannot read property 'subgrid' of undefined
// Error!!!!
grid.setValue(colPos['bob'], gridRow+1, rowData[i].bob);
grid.setValue(colPos['pi'], gridRow+1, rowData[i].key);
But when I use these two lines in my code then everything works fine
// No error!!!!!
grid.behavior.dataModel.setValue(colPos['bob'], gridRow, rowData[i].bob);
grid.behavior.dataModel.setValue(colPos['pi'], gridRow, rowData[i].key);
Is the grid.setValue method the one to use or is the grid.behavior.dataModel.setValue method the one to use?
The error only seems to happen when the height of the div containing the Hypergrid is smaller than the height that the Hypergrid eventually grows to as rows are dynamically added.
Contributor guide
Research direction
Reproduce the TypeError with grid.setValue while dynamically adding rows to a container shorter than the growing Hypergrid, then compare it with grid.behavior.dataModel.setValue. Trace the setValue call path and verify that the public grid.setValue API no longer accesses an undefined subgrid in this scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100