cscan / vue3-excel-editor

Vue3 plugin for displaying and editing the array-of-object in Excel style.
MIT License
231 stars 51 forks source link

Excel like formula feature #6

Open salimtirit opened 1 year ago

salimtirit commented 1 year ago

I am trying to use formulas in the sheet. To do this I used to-text prop then executed the input if it starts with = symbol. Now I want to show the formula when the cell is double clicked (in the edit mode). Is there a way to do this?

cscan commented 1 year ago

No simple way to do this. I suggest you may try to toggle the visibility of 2 columns and add the onChange event to make necessary changes. Anyway, I will consider to add the focus or double-click event in the future.

salimtirit commented 1 year ago

I gave up on this idea and went with another solution. Here is what I did: I used another json to keep the formulas and listened the cell-focus event. I found the corresponding formula (if there is one) when the cell-focus event occurs then showed it in an input field above the actual table. This also makes it possible to edit the formula. If it is changed I execute it and write the outcome back to the data. Thank you for considering adding new events I think it will be better.

cscan commented 1 year ago

Yes, you may also use get set variable in javascript. Will follow up about adding events