Skip to Content
0

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

Mar 06, 2017 at 03:45 PM

26

avatar image

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);

}

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Jun Wu Mar 06, 2017 at 04:35 PM
1

oEvent.getParameters().listItem

Share
10 |10000 characters needed characters left characters exceeded
Sudhakar Komatineni Mar 06, 2017 at 05:09 PM
0

Thanks Jun it worked.

Share
10 |10000 characters needed characters left characters exceeded