EXT JS - add a listener to any element added to the container

HI, I have an ExtJS parent container type, whereas I need to add a context menu listener to any item that is added to this parent container using Drag / Drop. Can someone help me do this as best as possible?

I tried this below, but can't run the function.

myContainer.on('added', function(obj1,obj2,index){
   alert('added');
});

It may not be "best practice" to do it anyway ...? thanks for the help!

+5
source share
1 answer

... added , ( ) myContainer - . add, , myContainer:

myContainer.on('add', function(container, component, index) {
    component.on('contextmenu', function() {
    });
});
+7

All Articles