set _x__.dragger.addDragLanding on fly


#1

In my source code I have 2 trees, each in different accordions. I realized dnd functionality (from that trees to custom div). it works fine and the following is a part of code:

function setDragLanding(){
var sinput=document.getElementById(‘proschviz’);

if (oppAccordion.cells('panel_2').isOpened()) {
	 tree1.dragger.addDragLanding(sinput, new s_control1);
 }
 
 if (oppAccordion.cells('panel_1').isOpened()) {
	 tree2.dragger.addDragLanding(sinput, new s_control2);
 }
 

 oppAccordion.attachEvent("onActive", function(itemId) {
       if(itemId=='panel_2') {
    	   tree1.dragger.addDragLanding(sinput, new s_control1);
       }
       if(itemId=='panel_1') {
    	   tree2.dragger.addDragLanding(sinput, new s_control2);
       }
    });

}

Is it possible to add drag landing source on the fly depending of wich source object user drags out from? Without detecting wich is active as in my sample. Further, sources will be different objects: trees, treegrids that attached to layouts, tabs, accordions and it will be complex to detect source.


#2

It possible to call addDragLanding from onBeforeDrag event of a tree. But maybe it has sense to use a different approach - have all landing defined by default and use onDragIn event to validate is dragged element allowed for this area, and return false when drop must be blocked.