Grid does not select last row on key event

I’m working with the selection on the grid. As the grid does not make the selection in the footer, I work with the beforeKeyDown event to check the down key, and remove the selection from the grid when reaching the last row, and create my own selection in the footer - I demarcate the column in the footer through css .

Up to this point ok, within the same event, it has a treatment for the up key, which checks if the footer is “selected”, if so, then removes my own selection from the footer and selects the cell of the last row. But it so happens that the cell in the last row is not selected. In my tests if I select a column other than the column that I had initially removed the focus from, the grid selects the second to last row and not the last one I am defining. I also noticed that the problem only happens if I remove the selection from the grid, if I don’t remove the selection within the down key handling, when selecting the cell of the last row in the up key handling, it works normal.

I created a snippet showing how I did it (without my footer selection handling), and was able to reproduce the problem.

https://snippet.dhtmlx.com/6b9dvkur

Is this a bug, or is there any way to select the last line after it deselects it?

Hello Douglas.

I apologize for the delay with the reply.
As I’ve already reported in the support ticket: The problem is confirmed. We’ll try to fix it in one of the future updates.
For now, as a workaround, you may try to select some intermediate cell before selecting the deselected cell. Something like:
https://snippet.dhtmlx.com/t79hho0x