Skip to content

How to prevent the ComboBox value change when using Arrow Keys navigation in a sap.ui.Table - Empower sap.ui.table with Excel-like functionalities (Part 3)

Blog Banner

Overview

In the previous blogs (Part 1 and Part 2) we saw how to implement some Excel-like functionalities in a sap.ui.Table.

The arrow keys navigation between comboboxes have an issue: the value of the cell is updated with the previous or next item.

We could try to use the preventDefault method but in this case it is not enough.

Today I want to share how I solved this issue by using the stopPropagation method.

Working in the App Designer

How it works

Inside the onkeydown event we check first if the current target has the combobox class and the key pressed is ArrowUp or ArrowDown.

Finally we use the stopPropagation method to prevent the standard behaviour and fix the issue.

Result

Here a GIF:

Prevent the ComboBox value change when using Arrow Keys navigation in a sap.ui.Table

Hope this helps

Happy holidays and keep rocking!