Home  >  Article  >  Web Front-end  >  The drag and drop function of tree in Extjs4 (you can drag and drop between two trees) simple example_javascript skills

The drag and drop function of tree in Extjs4 (you can drag and drop between two trees) simple example_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:10:311123browse
Copy code The code is as follows:

//As long as you want to configure the viewConfig in the treepanel, if it is Between two trees, both trees must be configured
viewConfig:{
plugins:{
ptype:'treeviewdragdrop',
appendOnly:true //Only non-leaf nodes can be dragged
},
listeners:{//Listener
drop:function(node,data,overModel,dropPosition,options){
//Ajax operation synchronizes data to the background database
alert("Move:" data.records[0].get('text') " to: " overModel.get("text")); 
 },
 beforedrop:function(node,data, overModel,dropPosition,dropFunction,options){
// if(overModel.get("leaf")){ //Target node
// overModel.set('leaf',false);
/ / }
}
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn