Cell click support for writing formulas

Tags: #<Tag:0x00007f343be6bda8>

Hi,

I’m trying to implement the Excel like feature which allows the user to click on a cell to get its index filled into the formula he is working on. For example the user types “=A1+” in a cell in edit mode and then clicks the cell A2, the content of the cell the user was typing in should become “=A1+A2” and be still in edit mode so the user can insert more content without having to go to edit mode by clicking the cell again. I got a naive implementation working but I cannot manage to get the edited cell back to edit mode after the click on another cell. I tried window.setTimeout to give HOT some more time. The editor will open with setTimeout but it will be empty in both tried cases (with initial value for beginEditing and without).
Here is my fiddle, I would be very happy if you could have a look: https://jsfiddle.net/fjd5u7bq/3/
Sorry for the commented code, but I hope it helps to see what I already tried. Unfortunately this feature is a must-have for our customer.

Best regards
Ole

Hi @ole.cordsen
I prepared a simple demo, using beforeOnCellMouseDown and afterOnCellMouseUp: https://jsfiddle.net/8otg3qk7/

The beforeOnCellMouseDown hook allows you to block “selection” on cells/columns/rows accordingly to your requirements. On the other hand, the afterOnCellMouseUp hook allows back with a :focus state and moves the caret to the end.

Of course, this example should be an inspiration rather than a final solution covering all use cases.

Hi @piotr.laszczkowski,
thank you very much, the fiddle looks really great! I’m not in the office this week, I will try integrate the code into our react codebase next week.

I’m glad that example might help. If you can, please let us know the results of integrating that solution into your application.
That will help others and us in picking issues to our roadmaps.