Search code examples
sapui5

UI5 sap.m.Table itemPress event


I have a sap.m.Table and I m trying to get the row information.

Here is my view.xml Table declaration:

<Table xmlns="sap.m" id="potiemsTable" inset="false" mode="MultiSelect" itemPress="rowSelectionChanged" >

And in the Controller I tried everything...But still no luck...

rowSelectionChanged: function(oControlEvent)
{
    var selectedRowContext = oControlEvent.getParameter("items"); 
    var link = oControlEvent.getSource().getBindingContext();
    var fr = oControlEvent.getBindingContext();
    var ctx = oControlEvent.getBindingContext();
    sap.m.alert(selectedRowContext);
},

The table uses bindAggregation to retrieve the rows through the provided OData service.

oTable.bindItems("/purchaseOrderSet(1)/purchaseItems",template);

Can someone tell me how to retrieve the context information of the clicked row?

Cheers!

Georgios


Solution

  • Please see the API documentation of itemPress event:

    Fires when an item is pressed unless the item's type property is Inactive.

    Please make it sure your ColumnListItems do have the type property rather than Inactive since Inactive is default value.