Hi Tomas De arco,
We have checked your reported requirement, and you can achieve it in
our spreadsheet by using our beforeSelect and select events and our startEdit() method.
We would like to let you know that the beforeSelect
event will trigger before the cell or range of cells is selected, and the
select event will trigger after the cell or range of cells is selected.
In the beforeSelect event, you can get the previously
selected cell from the worksheet while selecting a new cell. In the select
event, you can get the newly selected cell as the active cell from the
worksheet. By comparing the active cell values obtained in both events, we can
confirm that the same cell is not selected and a new cell is selected. After
confirming this, you can enable editing in the selected cell by calling our
startEdit() method in the select event, as shown in the code snippet below.
For your reference, we have shared the sample along with code snippets below.
Sample: https://stackblitz.com/edit/n5hcw1-gdxjzo?file=index.ts
CODE SNIPPET:
|
// The beforeSelect event will trigger before the cell or range of cells is selected
beforeSelect: (): void => {
activeCell = spreadsheet.getActiveSheet().activeCell;
},
// The select event will trigger after the cell or range of cells is selected.
select: (): void => {
// Browser.isDevice - To confirm if the device is a touch device
if (Browser.isDevice && activeCell !== spreadsheet.getActiveSheet().activeCell) {
spreadsheet.startEdit(); // To start editing the active cell
}
}
|
In the sample shared above, when you click on any cell, editing is enabled for
that cell. After making changes, if you click on a different cell, the edited
value is saved in the previously selected cell, and editing is then activated
for the newly selected cell.
Kindly check the sample and details shared above on your end and get back to us
if you need further clarification regarding this. We hope this helps.