cancel
Showing results for 
Search instead for 
Did you mean: 

sap mdk object table getSelectedItems binding is coming as undefined

sk_ramkumar
Participant
0 Kudos

Hi Experts, 

I am facing some problem with my application, I am trying to get selected items bindings from my Object table in a modal page on action bar item press, but it is returning undefined for binding. 

SelectableProxy getSelectionChangedItem is returning only one value with binding. 

getSelectedItems cell is returning only Title value ( I have binded only title). 

It was working fine in my previous projects. I using latest 24.4 version, testing in iOS. 

Screenshot 2024-05-03 at 10.13.13 AM.png

@bill_froelich @Jitendra_Kansal  Please help me here, as this is the major part in my application.

Thanks,

Ram

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos
Can you share page metadata to understand how exactly you are calling opening a modal page on action bar item press?

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

For an Object Table in multi-select mode you can get the reference to the section and call getSelectedItems() to get the list of the selected items.  The you can iterate over the list of selected items and perform your action.

 

var selectedItems = '';
let productListSection = context.getPageProxy().getControl('SectionedTable').getSection('ProductList');
let items = productListSection.getSelectedItems();
items.forEach(item => {
    selectedItems += item.binding.Name + '\n'; 
});

 

Calling getSelectionChangedItem() will only return the last item that was changed either selected or unselected and not the whole list.  Typically this is used when you have a rule associated to the Object Table OnSelectionModeChanged event which is triggered when a item selection state is changed and will return the item that was changed.

sk_ramkumar
Participant
0 Kudos

Thank you so much @bill_froelich.

 

Look like, the bind option is only possible if I include key in my object binding. If I want to display only the description and get the object binding, is there any way I can get that ?

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos
Assuming you are binding to an odata source the item.binding should have all the properties of the odata entity based on your Object Table target.

Answers (0)