Hello Tharaka, if you only need select a single row, then you can set mode SingleSelectmaster in your table.
var oTable = new sap.m.table("oTable",{mode: sap.m.ListMode.SingleSelectMaster}
For get index:
oTable.attachSelectionChange(function(oEvent) {
var oSelectedItem = oEvent.getParameter("listItem");
var sItemName = oSelectedItem.getBindingContext().getProperty("yourpropertyname");
alert(sItemName);
}
Full example: https://github.com/vobujs/UI5/tree/master/table/WebContent
Another possible way is to put a button on one of the columns. In the event onPress of the button enter this code
var buttonDetail = new sap.m.Button({
icon: "sap-icon://action",
type: sap.m.ButtonType.Emphasized,
press: function(evt) {
var idButton = this.sId;
var arrayId = idButton.split("-");
var tableIndex = arrayId[arrayId.length-1]; //get the row index
oController.go___(evt, tableIndex);
}
});