Ext.override(Ext.tree.TreeNode, {
clone: function() {
var atts = this.attributes;
if(this.childrenRendered || this.loaded || !this.attributes.children) {
var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
}
else {
var newAtts = Ext.apply({}, atts);
newAtts.children = this.cloneUnrenderedChildren();
var clone = new Ext.tree.AsyncTreeNode(newAtts);
}
clone.text = this.text;
for(var i=0; i<this.childNodes.length; i++){
clone.appendChild(this.childNodes[i].clone());
}
return clone;
},
cloneUnrenderedChildren: function() {
unrenderedClone = function(n) {
//n.id = undefined;
if(n.children)
{
for(var j=0; j<n.children.length; j++) {
n.children[j] = unrenderedClone(n.children[j]);
}
}
return n;
};
var c = [];
for(var i=0; i<this.attributes.children.length; i++) {
c[i] = Ext.apply({}, this.attributes.children[i]);
c[i] = unrenderedClone(c[i]);
}
return c;
}
});
Ext.override(Ext.tree.TreeNode, {
clone: function() {
var atts = this.attributes;
if(this.childrenRendered || this.loaded || !this.attributes.children) {
var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
}
else {
var newAtts = Ext.apply({}, atts);
newAtts.children = this.cloneUnrenderedChildren();
var clone = new Ext.tree.AsyncTreeNode(newAtts);
}
clone.text = this.text;
for(var i=0; i<this.childNodes.length; i++){
clone.appendChild(this.childNodes[i].clone());
}
return clone;
},
cloneUnrenderedChildren: function() {
unrenderedClone = function(n) {
//n.id = undefined;
if(n.children)
{
for(var j=0; j<n.children.length; j++) {
n.children[j] = unrenderedClone(n.children[j]);
}
}
return n;
};
var c = [];
for(var i=0; i<this.attributes.children.length; i++) {
c[i] = Ext.apply({}, this.attributes.children[i]);
c[i] = unrenderedClone(c[i]);
}
return c;
}
});
在拖拽目标树上加监听
Js代码
'beforenodedrop': function(e)
{//实现COPY拖拽
if(e.source.tree == e.target.ownerTree)
{
return true;
}
var n = e.dropNode; // the node that was dropped
var existNode = e.target.ownerTree.getNodeById(n.id);
if(e.source.tree.el != e.target.ownerTree.el&&existNode==undefined)
{
e.dropNode = n.clone(); // assign the copy as the new dropNode
}
else
{
return false;
}
}
分享到:
相关推荐
以前有许多人需要将 tree 的节点拖拽到其他控件中的问题,前段时间已经解决了,现在也将它的源代码贡献上来。 这个树的数据是静态的,没有做动态的,而且树节点的拖拽也没有做过多的处理,如果要知道怎么样做树...
目录: 1. layout-test-01.html为上下布局,并且显示...详细见代码。 2. layout-test-02.html为上下布局,并且显示区采用panel的autoload的例子。详细见代码。 ...即:Ext.window ...8.tree-tz-test.html为tree节点拖拽的练习
由于项目的需要最近在...例子里面包括了对tree增、改、删、拖动、子父节点的选则取消、右键操作的基本功能。例子可能会有bug如果那位网友发现了请留言告知以便做及时修改。例子用的ext是4.2的版本需要的话就快下载吧
3.9.1. 树形节点的拖拽有三种形式 3.9.2. 用事件控制拖拽 3.9.2.1. 叶子不能append 3.9.2.2. 把节点扔到哪里啦 3.9.2.3. 裟椤双树,常与无常 3.10. 树形过滤器TreeFilter 3.11. TreeSorter对树形排序 4. 祝福吧!把...
把表单和输入控件都改成ext的样式。 4.1. 不用ext的form啊,不怕错过有趣的东西吗? 4.2. 慢慢来,先建一个form再说 4.3. 胡乱扫一下输入控件 4.4. 起点高撒,从comboBox往上蹦 4.4.1. 凭空变出个comboBox来。 ...
目录: 1. layout-test-01.html为上下布局,并且显示...详细见代码。 2. layout-test-02.html为上下布局,并且显示区采用panel的autoload的例子。详细见代码。 ...即:Ext.window ...8.tree-tz-test.html为tree节点拖拽的练习
把表单和输入控件都改成ext的样式。 4.1. 不用ext的form啊,不怕错过有趣的东西吗? 4.2. 慢慢来,先建一个form再说 4.3. 胡乱扫一下输入控件 4.4. 起点高撒,从comboBox往上蹦 4.4.1. 凭空变出个comboBox来。 ...
支持用shift和ctrl来选择用户要拖动的树的节点和叶子。 功能非常强大。
可以把grid直接拖到tree,不同于其他的例子,拖动grid后会在tree中加一个叶子节点,大家试下就会明白。 自己练习用的哦,做的不好不要骂我,哪里不好希望大家包涵。 本人qq :784027965 大家学习happy哈^_^
由于原来的那两个资源文件不明白为什么丢失或者下载不了了,现在把最新完成的的工程打包发上来了,希望大家支持支持。
Ex4.0共2个压缩包特性,《ext js权威指南》 前 言 第1章 ext js 4开发入门 / 1 1.1 学习ext js必需的基础知识 / 1 1.2 json概述 / 3 1.2.1 认识json / 3 1.2.2 json的结构 / 3 1.2.3 json的例子 / 4 1.2.4 ...
通过树实现动态加载以及实现添加节点、删除节点、修改节点文本已经通过拖动移动节点等功能。先创建树的表结构:插入以下数据:首先创建基本页面:代码中已包含了样式、ExtJS的脚本文件和语言包。其实bootstrap.js会...
把表单和输入控件都改成ext的样式。 4.1. 不用ext的form啊,不怕错过有趣的东西吗? 4.2. 慢慢来,先建一个form再说 4.3. 胡乱扫一下输入控件 4.4. 更绚丽的效果和功能 5. 雀跃吧!超脱了一切的弹出窗口。 ...
menuTree:new Ext.tree.TreePanel({ title:'功能菜单', region:'west', bodyStyle:'background:transparent url(images/default/panel/group-lr.gif) repeat-x 0 bottom;', id:'extExample-tree', autoScroll:true, ...
-优化Tree节点的NodeId自动生成,减少ViewState占用。 +2009-08-09 v2.0 beta5 +ExtAspNet和Asp.net的提交按钮兼容问题(feedback:千帆)。 -在2009-03-03 v1.3.0曾经提到这个兼容问题,并有这样的规则,如果...
var contacterTree = new Ext.tree.TreePanel({ id:"treePanelContact", border:false, lines:false, // 去掉树的线 rootVisible:true, autoScroll:true, animate:true, width:200, height : 468, ...
2.6、ExtJs中的ExtTree详解 3、ExtJs数据篇 3.1、数据存储基本单元Record与DataField详解 3.2、数据存储Store详解1 3.3、数据存储Store详解2 3.4、数据代理DataProxy详解 3.5、数据读取器DataReader详解 3.6...
-v0.2beta2版本中关于PersistChildren(true)的描述有误,这个是设计时属性,和运行时是否保持状态没有关系。 -修正CheckBox控件的CheckedChanged事件会被触发两次的BUG(Data PostBack->AutoPostBack, Event ...