HI, I have a ExtJS parent 'container' type, whereas i need to add a 'contextmenu' listener to any element that is added to this parent container, via Drag/Drop. Can someone guide me as to the best way to do this?
I have tried this below but can't get the function to fire.
myContainer.on('added', fu开发者_开发问答nction(obj1,obj2,index){
alert('added');
});
this may not be the 'best practice' to do it this way anyway...? thanks for the help !
You're using the wrong event... The added
event gets fired when (using your example) myContainer
is added to some other container. What you'll need is the add
event that fires, when an item is added to myContainer
:
myContainer.on('add', function(container, component, index) {
component.on('contextmenu', function() {
});
});
精彩评论