cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to retrieve data from multiple selected values in table

0 Likes
962

Hey everyone, hope you guys can help me with this.

I have been trying to extract the values from the selected values on a table. I used the following the table with MultiSelectionPlugin and I have not been able to get the selected VALUES, only the indices which I can't compare to the original model data because they change if the table is filtered.

Is there any way to get an array of objects of the selected items only?

From what I've read on other answers getSelectedItems() and getSelectedContexts() would work great but they are to available for me FSR. Also something like getRows() that gives the full array of items already filtered would let me retrieve the data with just the indices gotten from .getSelectedIndices()

I'm on UI5 1.96.22

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Marian_Zeis
Active Contributor

You can use getSelectedItems().

Just like:

var table = this.getView().byId("myTable");
var selectedItems = table.getSelectedItems();
var selectedData = selectedItems .map(function(item) {
return item.getBindingContext().getObject();
});
Does this work for you?