我就是想在extjs的tree的拖拽成功之前加上事件监听,实现在拖拽的时候有提示,等用户确认后 实现拖拽用户取消则不拖拽。
我使用 tree.on('beforenodedrop',function(dropEvent){
      //dropEvent.dropStatus=true;
      
      Ext.log(dropEvent.target); 
        Ext.Msg.confirm('确认',"请确认是否要把菜单移动!",function(button){         if(button=='yes'){  
                    dropEvent.cancel=false;
        }else if(button=='no'){
            dropEvent.cancel=true;
        }
        }
        );
        但是在没有确认的时候tree的拖拽已经完成。 不知道各位大侠有什么好的方法

解决方案 »

  1.   


    tree.on('beforenodedrop',function(dropEvent){
          dropEvent.preventDefault = true;
          dropEvent.stopPropagation = true;     
          Ext.log(dropEvent.target); 
            Ext.Msg.confirm('确认',"请确认是否要把菜单移动!",function(button){            if(button=='yes'){  
                        dropEvent.cancel=false;
                }else if(button=='no'){
                    dropEvent.cancel=true;
                }
            }
            );试试看
      

  2.   

    这个方法可以 大家试一试
            tree.on('beforenodedrop', function(e) {
        var n = e.dropNode;
        var t = e.target;
        Ext.Msg.confirm('确认', "请确认是否要把菜单移动!", function(button) {
    if (button == 'yes') {t.appendChild(n);}
        });
        return false;
    });
      

  3.   

    没用过,是不是drop时,已执行了移动操作?如果这样,可以按下面试试:
    click 时记录原始位置,
    drop 时如果取消,则恢复原始位置;否则
      

  4.   

    uuyufsfsdf     tree.on('beforenodedrop', function(e) {
                var n = e.dropNode;
                var t = e.target;
                Ext.Msg.confirm('确认', "请确认是否要把菜单移动!", function(button) {
                if (button == 'yes') {t.appendChild(n);}
                });
            return false;
        });