I need to save product IDs(will be used ono the frontend later) into the extension attribute of the related product.
Idea is that modal with products listing should appear when I click the 'Select products' button. I already implemented saving and displaying value of the extension attribute in the input field, now the question is, how can I connect selected IDs from the modal, with the input field in the grid?
Input value should look something like this: 34151,24562,77542
Here is the picture of what I currently have:

I tried using vanilla JS for this, but it's too dirty and it's not even working. Only clean solution is using UI components.