I’m trying to create a single “formula bar” <input> that sits outside my Handsontable grid, just like in Excel.
My goal is a two-way data binding:
- Grid-to-Input: When a user clicks a cell, its data loads into the external
<input>. - Input-to-Grid: When a user types in the external
<input>, it edits the currently selected cell in real-time.
What I’ve tried so far:
I’ve gotten part-way there:
- I’m using the
afterSelectionhook to get the cell’s data and display it in my<input>. - I’m using an
inputevent listener on my text box to callsetDataAtCellon the selected cell.
My Problem:
This almost works, but I have a major focus issue:
When a user clicks a cell, it’s selected and the input bar is updated (Good!). But as soon as the user clicks into the external input bar to start typing, the Handsontable grid loses focus.
My Question:
What is the best-practice way to build this?
example: Basic Handsontable Sheet - JSFiddle - Code Playground