Datasource selection not working

Hi,

I have altered the default datasource for my browser screen using custom filter however when I use a picker field and use the filter to find specific item I receive no value when I select the result.

This is the code used to populate the datasource.

itemsDs.clear();

for (Item i : res) {
    itemsDs.addItem(i);
}

Thanks

This is the screen where I start to add items

35%20PM

This is the screen that opens when I click the … button with an example search
51%20PM

However when I select I don’t receive a value in the first screen but when I don’t use the custom filter I have it selects the item and I receive the value. I think for some reason something is missing when adding the items to the datasource that is causing this issue.

res is a List of of type <Item> same as what is in the standard datasource for entity screen.

itemsDs.clear();

for (Item i : res) {
    itemsDs.addItem(i);
}

Kind regards,
Mohamed