Capture data of selected cell before outsideClickDeselects

Tags: #<Tag:0x00007f8b1d96a528>

I am setting outsideClickDeselects : false to remove focus on handsontable. But I need to capture cell data before losing focus. Please help.

Hey @bhakat.sandip

maybe you can trackwhat’s under getSelected method and update it with the afterSelectionEnd hook.

Hi @aleksandra_budnik,

Thanks for the quick response.

I want to capture entered data from selected cell before outsidedeselect execute. The selected cell gives null value not the entered one.

Maybe something like this https://jsfiddle.net/wfvpnjug/?

On further analysis, out side click of handsontable called earlier than afterChange event. So, I am not able to capture last entered data. how can I make afterChange call earlier than outside click?

Hi @aleksandra_budnik,

I am able to capture data with a trick. Inside outSideClickDeselects function I change cell selection due to that afterChange event call and data capture. will it create any issue?

Hey @bhakat.sandip

how do you associate those two options?
The afterChange/beforeChange hooks are responsible for changes (edit, paste, autofill) not the selection.

Hi @aleksandra_budnik,

Before clicking outside a cell was selected; so, I manually triggered ‘tab’ inside outsideClickDeselects. Due to this afterChange call before loosing selection.
outsideClickDeselects: function (event) {
ht.runHooks(‘Tab’, ‘afterDocumentKeyDown’);
return false;
},

You may try with the [afterDocumentKeyDown](https://handsontable.com/docs/7.3.0/Hooks.html#event:afterDocumentKeyDown) event as apparently you need to get the editor value (before it closes the editor and trigger beforeChange/ afterChange hooks)