PDA

View Full Version : Dropzone does not working after hidden and setVisible(true)



LizMyself
16 Oct 2014, 12:55 AM
Hey together,
I have a panel as a Dropzone.
I want to hide it and show it after start dragging.

If i doen't hide and show it, everything is working just fine.

But if i hide it, the dropping is not working anymore.
This is my Code, the afterLayout function is called after each showing, i did test this. But the notifyEnter etc does not work anymore.
Is there something i have to consider? Thanks for your help!



afterLayout: function() { var that = this;
var usePart = this.el;
this.containerPanelDropTarget = new Ext.dd.DropTarget(usePart, {
ddGroup: 'reportelement-dd-group',
notifyEnter: function(ddSource, e, data) {
that.addCls('dark-green-background');
},
notifyOut: function(ddSource, e, data) {
that.removeCls('dark-green-background');
},
notifyDrop: function(ddSource, e, data) {
that.removeCls('dark-green-background');
if (ddSource.panel.lid === "moveImg"){
that.up('wizardViewdefinitionCenterPanel').fireEvent("moveChildToVertical", ddSource.panel, that.up('ElementParent').firstLevelChildrenNumber, that.childnr);
}
else{
that.up('ElementParent').fireEvent("addChild",that.childnr, ddSource.panel);
}
return true;
}
});
}

slemmon
22 Oct 2014, 8:39 PM
Hi,

It might help to see a test case the demonstrates the issue including the hiding / showing of the panel set as the drop zone. You can post a test case at https://fiddle.sencha.com.

LizMyself
1 Apr 2015, 1:16 AM
I added this code to my view to destroy the dropzone bevor hiding and build it again before showing.
This works!


listeners:{
beforehide:function(){
if(this.down("[lid=dropZoneContainer]")){
this.down("[lid=dropZoneContainer]").destroy();
}
},
beforeshow: function() {
this.addNewDropTarget();
}
},