Dynamically edited cell value is empty

Tags: #<Tag:0x00007efc72ef7890>

I apologize if my question was already answered but I didn’t find any relevant answer.

I would like to dynamically edit cell value therefore I used:
hot.getActiveEditor().beginEditing();

it edits cell but I don’t see original value, only empty.

Example:
https://jsfiddle.net/janzitniak/qdg420v8/6/

Please select to any cell and then click to Set value to selected cell button.
Thank you for any help.

Hi @jan.zitniak

This is the intended behavior. Its result by this piece of code - https://github.com/handsontable/handsontable/blob/master/src/editors/textEditor.js#L190

If you want to behave just like when clicking enter (i.e. open the editor and set caret after a value) you have to simulate this behavior.

If I may ask, what are the requirements for your project?

Dear @piotr.nowak,

thank you for your answer. My plan is make possibility to choose empty formula (SUM, AVERAGE, COUNT, etc.) from list and insert it into selected cell and immediately show it in editable mode (and user finishes that formula).

Therefore I used a following (I made shorten version of my original source code):

value = "=SUM()";
var selected = hot.getSelected();
var item = selected[0];
var startRow = Math.min(item[0], item[2]);
var startCol = Math.min(item[1], item[3]);
hot.setDataAtCell(startRow, startCol, value);
hot.getActiveEditor().beginEditing();

I can prepare JSFiddle example if you prefer …
Jan

I’ll be appreciative for the working demo.
It could easier to find a solution.

@piotr.nowak please check my working demo at
https://jsfiddle.net/janzitniak/qdg420v8/17/

I’m not sure that your requirements are even available.

All formulas have to defined previously on the data set.
Here is a link to demo with sum in the concrete cells - https://jsfiddle.net/9ut835po/

So you couldn’t dynamically act in formulas on the fly.

Thank you for your answer, it’s pity!