Auto scroll to the cell top when click the button in cell

Tags: #<Tag:0x00007f135f4b2c00> #<Tag:0x00007f135f4b2ac0>

Hi, When I merge many rows to one cell in one column and show a button in it, If I click the button, it will auto scroll to the top od the merge cell, and will not trigger the button event, I have set the disableVisualSelection:true, but it seems not work, wait for your reply, Thank you!

I see that you mean, @zhouchenyang123

When we set the logic like this https://jsfiddle.net/o9s3vubt/ we are scrolled before the check() method executes.

But, you can use our hook for the mouseDown event called afterOnCellMouseDown to run your logic. Here’s a demo https://jsfiddle.net/o9s3vubt/1/

1 Like

Thanks for your reply, I have tried your method and success to solve my problem.
But it also scroll to the cell top if I click the button. if there is a parameter can be set to prevent auto scorlling.

We will be changing this behavior in the next version (minor release). Here https://github.com/handsontable/handsontable/pull/10709 is a pull request with an explanation.

Implementation details

Features

  1. The viewport won’t be scrolled after clicking the partially visible cell. The rule only applies in cases when the visible beginning of the cell is clicked (the cell is partially visible on the right edge of the table). When the end of the partially visible cell is clicked, the viewport is scrolled to the whole cell.

Bug fixes

  1. Fixed a bug that causes the viewport to scroll in the wrong direction. It happens only after applying the selection for the first time (after table initialization).

That’s so good. Thank you very much!

You’re more than welcome @zhouchenyang123