0 votes
1 view
in SAP by (7k points)

I've written an XML view. Inside it there is a table:

<Table xmlns="sap.m"
  itemPress="console.log('clicked on item')"
    <!-- sap.m.Column -->
    <!-- sap.m.ListItemBase -->

I insert the row to the table using the onInit of the controller, but when I click on a row, the message is not shown.
If I use console.log(tablePippo.getProperty("itemPress")); inside the controller, it throws

Uncaught Error: Property "itemPress" does not exist in Element sap.m.Table#operationDetail--myTable

1 Answer

0 votes
by (14.5k points)

As far as my experience allows me to understand, this issue comes up quite frequently when users leverage sap.m.ListBase related controls. 

The confusion is mostly related to the sap.m.ListMode of controls that are inherited from sap.m.ListBase and sap.m.ListType of items that are inherited from sap.m.ListItemBase.

Assuming the following sample List:








      title="Hello ListItem"





sap.m.ListMode (Sample)

While using sap.m.List or sap.m.Table, event firing depends on the mode which is being used. Unfortunately, a List or Table without a mode will not fire any event. If the firing of those events is required, users should use




These are the possible modes from the sap.m.ListMode documentation:

None (default)

Since no mode property is assigned, none of the events will be fired!

SingleSelect | SingleSelectLeft

List controls that have a  mode="SingleSelect" show a radio button on the right side of each item and they will fire the onSelectionChange event the moment users click on the given radio button control. Using "SingleSelectLeft" just moves the radio button to the left side of the item.


List controls with mode="SingleSelectMaster" will show the hand on mouseover and fire the onSelectionChange in case of a click on an item.


List control in mode="MultiSelect" offer a checkbox and fire the onSelectionChange event on every check and uncheck of an item.


Using the list in mode="Delete" gives users a delete button and fires the event onDelete.

sap.m.ListType (Sample)

Every item inherits from sap.m.ListItemBase and thus has an attribute called type. 









There are these types listed in the sap.m.ListMode documentation:


Depending on the mode, the itemPress of the list and press of the list item can be fired. The selected item gets highlighted so the user can see what's selected.


A detail button (with icon sap-icon://edit) is offered which fires the detailPress event.


As the name says, this is a combination of Detail and Active type. So you have the detail button firing detailPress on button click, and the item itself firing the list event itemPress.


The items have a navigation look, and itemPress and item's press are called.


No item event gets called from the item itself.

Considering your problem, you should either assign your Table control a mode or assign your items a type. After that, you are required to change the events that should be fired.

Generally, I would avoid using a ListMode and a ListType at the same time since there can be unexpected behavior but check it by yourself.

For more knowledge, you can go through SAP Fiori blog online or also you can join SAP Fiori training  

Welcome to Intellipaat Community. Get your technical queries answered by top developers !