cancel
Showing results for 
Search instead for 
Did you mean: 

how to get sap.m.list item that is pressed using press event listener

Former Member
0 Kudos

Hi Experts,

I am using the sap.m.List in my code, able to display list of items.

upon pressing the list item I need to capture the item that is pressed using press event listener.

Please help me in getting the list item pressed.

View Code:

---------------

<Listid="listId"

items="{/}"

itemPress="listItemPress">

<items>

<StandardListItem title="{dtext}"

type="Active"/>

</items>

</List>

Controller Code:

----------------------

listItemPress: function(oEvent) {

var oContext = oEvent.getSource().getBindingContext();

var selectedIndex = oContext.sPath.split("/")[2];

console.log(oContext);

}

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor

oEvent.getParameters().listItem

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks Jun it worked.