i am trying to attach the itemPress event for SmartTable control in sap UI5. The view is defined in XML and bind to OData.
<mvc:View
controllerName="myapp.controller.App"
...>
<App>
<pages>
<Page title="title">
<content>
<smartTable:SmartTable
id="kubas"
...
tableType="ResponsiveTable"
...>
</smartTable:SmartTable>
</content>
</Page>
</pages>
</App>
</mvc:View>
Since for the ResponsiveTable the table behind is sap.m.Table i was trying to attach the itemPress event in the onAfterRendering event of controller. It did not work. Then i tried to override the onAfterRendering of the table itself and there attach the event - same effect, the event did not trigger.
onAfterRendering : function(){
var tTable = this.byId("kubas");
var oTable = this.byId("kubas").getTable(); //sap.m.table
console.log(oTable.getMetadata().getName());
oTable.setMode(sap.m.ListMode.SingleSelectMaster);
oTable.onAfterRendering = function(){
console.log("OnAfterRendering");
this.attachItemPress(function(oEvent){
console.log("Pressed!!");
});
}
Do i do something wrong here, any suggestions ? Is there any way to register it in XML for SmartTable ? I would like not to switch to sap.m.table in the XML view but leave it as it is. Would appreciate your help Gurus.