I have a table with a hidden column, when I press ‘Home’ I get taken to the first column and I can’t get out with the left/right arrow keys
Can I rebind ‘Home’ so it always goes to Column 1 instead of Column 0 ?
I have a table with a hidden column, when I press ‘Home’ I get taken to the first column and I can’t get out with the left/right arrow keys
Can I rebind ‘Home’ so it always goes to Column 1 instead of Column 0 ?
Hi @HC289
You can use the beforeKeyDown
hook to change the default behavior of a keyboard.
You may start with event.stopImmediatePropagation()
/ event.preventDefault()
and then you can attach your own logic with selectCell.
Sorry it took me so long and thanks Aleksandra. I’m using this to solve my issue - all feedback welcome:
const beforeKeyDownHandler = evt => {
// We're using a hidden first column for persisted metadata, the user gets stuck in it invisibly if they press 'home'
// without this override
if (evt.keyCode === 36) { // Home key
evt.stopImmediatePropagation()
let currentlySelectedCell = hotTableComponent().getSelected()[0][0]
if (currentlySelectedCell) {
hotTableComponent().selectCell(currentlySelectedCell, 1)
}
}
}
@aleksandra_budnik Can you report this as a bug? Home
key should move the active selection to the first rendered column (in the selected row) and allow arrow navigation.
Thank you for noticing @wojciech.czerniak You are right. And it seems to be a change in the behavior since.
7.4.2 https://jsfiddle.net/handsoncode/gbdrxmue/ moves the selection to the first visible cell
8.0.0 https://jsfiddle.net/handsoncode/gbdrxmue/1/ moves to A column which is hidden
Tested on Windows 10 / Chrome 87.
I’ve reported the issue on our Github board https://github.com/handsontable/handsontable/issues/7454 and will update you @HC289 once we get this done.
Hi @HC289
I just wanted to let you know that we’ve fixed this issue for version Handsontable v8.3.2 (released today).
If, for some reason, it won’t work for you please send me an email.