Show TOC

List and Table EventsLocate this document in the navigation structure

Both sap.m.List and sap.m.Table offer the same events, inheriting them from sap.m.ListBase

The events are:

  • delete
  • selectionChange
  • swipe

All are handled in the same way, in that an event is fired, and the event object that is passed contains listItem data that tells you which items were affected. As with the list, the table has SwipeContent aggregation, and you can set the swipe direction:

<Table
   swipeDirection="RightToLeft">
   <swipeContent>
       <Button 
           text="press me for action" 
           press="handleAction"/>
   </swipeContent>
   <columns>
   ...

handleAction: function(e) {
   oTable = this.getView().byId("myTable");
   jQuery.sap.log.info("Swiped item:", oTable.getSwipedItem());
   oTable.swipeOut();
}

The SwipeContent is a control that appears on the right hand side of a list item when a swipe gesture is made on the item. We can define handlers for different events that can be triggered:

<Table
   delete="deleteHandler"
   swipe="swipeHandler"
   selectionChange="selectionChangeHandler"
   ...
Note

To test swipe gestures on the desktop, open the Chrome developer tools, and within Settings → Overrides, check the "Emulate touch events" checkbox and reload the page.