PDA

View Full Version : Ext.dd.DropTarget onNotify scope?



23 Feb 2011, 1:35 AM
Hi,

I have a DropTraget and a notifyDrop, see code snippet :




test: function() {

var dropTargetDataView = new Ext.dd.DropTarget(this.myElelement.getEl(),{
ddGroup : 'myDD',
copy : false,
overClass : 'over',
notifyDrop : this.onNotifyDrop,
});

},

onNotifyDrop: function() {
alert("yay");
}
But I noticed the onNotifyDrop is not in my class scope anymore. Is there a way to add a scope to the notifyDrop?

danguba
23 Feb 2011, 2:14 AM
test: function() {

var dropTargetDataView = new Ext.dd.DropTarget(this.myElelement.getEl(),{
ddGroup : 'myDD',
copy : false,
overClass : 'over',
notifyDrop : this.onNotifyDrop.createDelegate(this),
});

},

onNotifyDrop: function() {
alert("yay");
}

23 Feb 2011, 2:52 AM
yes .. that did the trick ... I completely forgot the createDelegate function

thnx

danguba
23 Feb 2011, 3:33 AM
It's hardy worth mention :D