In Extjs4 the tree drag function of can drag and drop simple instances between two trees

  • 2020-03-30 00:47:40
  • OfStack


//Just configure viewConfig in treepanel. If it's between two trees, configure & NBSP; both trees;
  viewConfig:{
   plugins :{
    ptype:'treeviewdragdrop',
    appendOnly:true   //Can only be dragged along with non-leaf nodes
   },
   listeners:{//The listener
    drop:function(node,data,overModel,dropPosition,options){
     //The ajax operation synchronizes the data to the backend database
     alert(" the :"+data.records[0].get('text')+"  Move to: "+overModel.get("text"));    
    },
    beforedrop:function(node,data,overModel,dropPosition,dropFunction,options){
//     if(overModel.get("leaf")){   // The target node 
//      overModel.set('leaf',false);
//     }
    }
   }
  }

Related articles: