Our team is evaluating Handsontable for a React-based application. We need to verify the best practices for implementing complex, cascading row dependencies using the @handsontable/react wrapper.
Requirement Details
We require a workflow where a selection in one cell dynamically updates both the values and the available options (dropdown sources) of other cells in the same row.
-
Level 1 Dependency: Selecting a “Client” from a dropdown triggers an update to the row, filling a static “Address” cell.
-
Level 2 Dependency (Cascading): The “Client Contact” cell in that specific row must dynamically update its
sourcearray to show only persons associated with the selected Client. -
Level 3 Dependency: Selecting a “Contact Person” then auto-populates the “Email” and “Phone” columns.
Technical Environment
-
Framework: React
-
Library:
@handsontable/react
Example Data Structure
JSON
{
"name": "Handsontable",
"address": "Xyz lane, zyx",
"contact_persons": [
{ "name": "Person1", "phone": "+175434423", "email": "person1@test.com" },
{ "name": "Person2", "phone": "+175434424", "email": "person2@test.com" }
]
}
Technical Inquiry
-
State Management: When using the React wrapper, what is the recommended way to handle these cascading updates? Should we rely on the
afterChangehook to callsetDataAtRowProp, or is there a more “React-way” using state? -
Dynamic Cell Properties: How should we efficiently update the
sourceof a dropdown for a single row without affecting the dropdown sources of other rows in the same column? -
Performance: Given that cascading updates can trigger multiple renders, do you provide a recommended pattern to ensure the UI remains performant during these batch updates?