cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 mark row selected

former_member635635
Participant
0 Kudos

Hello experts,

Could you help me?

I need set a row in a table as "selected". But I can´t do it.

I know how to get row selected and remove the selections... but how I can mark?

var oTable = this.getView().byId("TableID");

var oContext = oTable.getSelectedContexts();

oTable.removeSelections(); oTable.setSelectContexts(1);

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

BGarcia
Active Contributor
0 Kudos

Hi Celio,

Can you try one of the following options:

1) setSelectedItem
oTable.setSelectedItem(oTable.getItems()[0])
-> This would select first row (0)

2) setSelectedItemById
oTable.setSelectedItemById("__item0-__xmlview0--testTable-0");
-> This would select row with mentioned ID

Kind regards,
Garcia

Answers (0)