Remove Listener on browse inner editwindow

Hi

I try invoke removeItemChangeListener on the browse which there is inner editwindow.
I register listener on datasource like below in init method in my edit controler

orderLineDs.getDatasource().removeItemChangeListener(listener -> {

  });

When I execute standard browse delete action this listener doesn’t invoke.

Hi!

removeItemChangeListener removes ItemChangeListener. Method addItemChangeListener adds ItemChangeListener. By the way, it is not the listener you need.

Use

collectionDs.addCollectionChangeListener(e -> {
            if(e.getOperation() == CollectionDatasource.Operation.REMOVE) {
                List<StandardEntity> items = e.getItems();
                // items are the list of deleted items
            }
        });

Ok How can I get current delete item in this listiner ?

collectionDs.addCollectionChangeListener(e -> {
            if(e.getOperation() == CollectionDatasource.Operation.REMOVE) {
                List<StandardEntity> items = e.getItems(); // These are the items you are looking 
                if(!items.isEmpty()) {
                    StandardEntity deletedItem = items.get(0);
                }

            }
        });

The list items will contain single item, if you remove the single item. If you remove several items, the list will contain them all.