I am evaluating use of Handsontable for my employer. I want to use the React wrapper but I am struggling to get it to work for our use case. I have reviewed both the documentation and forums extensively, and have not found clear answers about how best to use Handsontable with React. I will summarize our use case and explain the questions I have.
Our use case:
- React app
- Data is loaded using React hooks
- State is managed using Mobx or React hooks
- Multiple users can make changes to the same table at the same time, so data needs to be updated in the table after the table renders. These changes are pushed using webhooks.
- Hiding columns / filter data is enabled and tracked not only within the table but using other components next to the table. For instance, show a “Reset Columns” button when the user has hidden columns.
Problems / Questions:
- It seems like the HotTable implicitly expects the table to never rerender (not mentioned in the docs?). And if a rerender does occur then the table may reset completely. Is that correct? If so, how do you suggest to nest the table within a parent that may rerender?
- It appears that you cannot use the
useStatehook in the same component as the HotTable component, because changes to state will trigger a rerender of the HotTable. If the table is used to set the state then that will create an endless loop. I would like to track columns hidden in the table, and allow the user to select / deselect columns using a dropdown outside of the table. Can you suggest how to do this? - What happens when props to the HotTable change? Are those expected to be static?
- What is the difference between data and source data? If I reorder the columns which will return the data as it was originally provided to the data?
- Do you have example code where the HotTable loads non-static data? And updates data after first-rendering? That would be enlightening.