on 2023 Mar 29 3:20 PM
Hi Experts,
I am using sap.ui.table.Table and I am trying to set the check box selection programmatically using the below code ,
I am able to see the check box being selected during the debug session but its getting cleared after that. Can you please let know am I missing any thing here.
var rows = this.getView().byId("Table").getRows()[1];
rows._setSelected(true);
Thanks,
Vinodkumar.
Request clarification before answering.
Hi Vinodkumar,
The reason that the checkbox selection is getting cleared after the debug session is because the _setSelected method is a private method of the sap.ui.table.Row class and is not intended to be called directly by application code.
Instead, you can use the setSelectedIndex method of the sap.ui.table.Table control to programmatically select rows in the table.
var oTable = this.getView().byId("Table");
var oRow = oTable.getRows()[1];
oTable.setSelectedIndex(oRow.getIndex());
To select multiple rows, you can pass an array of row indices to the setSelectedIndices method instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You very much 🙂
User | Count |
---|---|
73 | |
18 | |
10 | |
9 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.