SAPUI5 table: get none-displayed values of selected row?
-
21-12-2019 - |
Question
I have a SAPUI5 (OpenUI5) application with a table. This table is bound to a (JSON) model and display the name of the entity and some other attribute - but not the technical key. The user should have the opportunity to select multiple lines in the table and the application should then be able to get the technical keys of the selected lines (probably using the underlying model). How would I do such a thing?
Thanks in advance!
Solution
The rowSelectionChange event has a rowContext attribute. A better approach would be
rowSelectionChange: function(oEvent) {
console.log(oEvent.getParameters().rowContext.getProperty("your_key"));
}
to obtain the value of your key (or any field in the selected row by adapting the getProperty value accordingly)
OTHER TIPS
when you will select a row in a table, there is a event called "rowSelectionChange". Use this event and getSelectedInedx of row. Using the index value loop over your json and get values selected row.