forked from zTree/zTree_v3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 'onDragMove' callback & change the event in 'onCheck' callback
- Loading branch information
ztree
committed
Nov 24, 2013
1 parent
e4416d5
commit 1451135
Showing
20 changed files
with
252 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="apiDetail"> | ||
<div> | ||
<h2><span>Function(event, treeId, treeNodes)</span><span class="path">setting.callback.</span>onDragMove</h2> | ||
<h3>概述<span class="h3_info">[ 依赖 <span class="highlight_green">jquery.ztree.exedit</span> 扩展 js ]</span></h3> | ||
<div class="desc"> | ||
<p></p> | ||
<div class="longdesc"> | ||
<p>用于捕获节点被拖拽过程中移动的事件回调函数</p> | ||
<p class="highlight_red">主要用于捕获 zTree 节点拖拽到的 DOM,从而操作对应的 DOM。</p> | ||
<p>默认值:null</p> | ||
</div> | ||
</div> | ||
<h3>Function 参数说明</h3> | ||
<div class="desc"> | ||
<h4><b>event</b><span>js event 对象</span></h4> | ||
<p>标准的 js event 对象</p> | ||
<h4 class="topLine"><b>treeId</b><span>String</span></h4> | ||
<p>被拖拽的节点 treeNodes 所在 zTree 的 <b class="highlight_red">treeId</b>,便于用户操控</p> | ||
<h4 class="topLine"><b>treeNodes</b><span>Array(JSON)</span></h4> | ||
<p>要被拖拽的节点 JSON 数据集合</p> | ||
</div> | ||
<h3>setting & function 举例</h3> | ||
<h4>1. 拖拽节点时,随时输出 当前拖拽到的目标 DOM</h4> | ||
<pre xmlns=""><code>function zTreeOnDragMove(event, treeId, treeNodes) { | ||
console.log(event.target); | ||
}; | ||
var setting = { | ||
callback: { | ||
onDragMove: zTreeOnDragMove | ||
} | ||
}; | ||
......</code></pre> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="apiDetail"> | ||
<div> | ||
<h2><span>Function(event, treeId, treeNodes)</span><span class="path">setting.callback.</span>onDragMove</h2> | ||
<h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3> | ||
<div class="desc"> | ||
<p></p> | ||
<div class="longdesc"> | ||
<p>Used to capture the drag-move event when drag & drop node.</p> | ||
<p class="highlight_red">Mainly used to capture the DOM which the nodes was drag in. </p> | ||
<p>Default: null</p> | ||
</div> | ||
</div> | ||
<h3>Function Parameter Descriptions</h3> | ||
<div class="desc"> | ||
<h4><b>event</b><span>js event Object</span></h4> | ||
<p>event Object</p> | ||
<h4 class="topLine"><b>treeId</b><span>String</span></h4> | ||
<p>zTree unique identifier: <b class="highlight_red">treeId</b>, the tree is what the treeNodes are belong to, easy for users to control.</p> | ||
<h4 class="topLine"><b>treeNodes</b><span>Array(JSON)</span></h4> | ||
<p>A collection of the nodes which will be dragged</p> | ||
</div> | ||
<h3>Examples of setting & function</h3> | ||
<h4>1. When drag nodes, output the target dom.</h4> | ||
<pre xmlns=""><code>function zTreeOnDragMove(event, treeId, treeNodes) { | ||
console.log(event.target); | ||
}; | ||
var setting = { | ||
callback: { | ||
onDragMove: zTreeOnDragMove | ||
} | ||
}; | ||
......</code></pre> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
/* | ||
* JQuery zTree core v3.5.16-beta.2 | ||
* JQuery zTree core v3.5.16-beta.3 | ||
* http://zTree.me/ | ||
* | ||
* Copyright (c) 2010 Hunter.z | ||
|
@@ -9,7 +9,7 @@ | |
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* email: [email protected] | ||
* Date: 2013-11-03 | ||
* Date: 2013-11-24 | ||
*/ | ||
(function($){ | ||
var settings = {}, roots = {}, caches = {}, | ||
|
@@ -1678,7 +1678,7 @@ | |
consts = zt.consts; | ||
})(jQuery); | ||
/* | ||
* JQuery zTree excheck v3.5.16-beta.2 | ||
* JQuery zTree excheck v3.5.16-beta.3 | ||
* http://zTree.me/ | ||
* | ||
* Copyright (c) 2010 Hunter.z | ||
|
@@ -1687,7 +1687,7 @@ | |
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* email: [email protected] | ||
* Date: 2013-11-03 | ||
* Date: 2013-11-24 | ||
*/ | ||
(function($){ | ||
//default consts of excheck | ||
|
@@ -1750,7 +1750,8 @@ | |
var o = setting.treeObj, | ||
c = consts.event; | ||
o.bind(c.CHECK, function (event, srcEvent, treeId, node) { | ||
tools.apply(setting.callback.onCheck, [!!srcEvent?srcEvent : event, treeId, node]); | ||
event.srcEvent = srcEvent; | ||
tools.apply(setting.callback.onCheck, [event, treeId, node]); | ||
}); | ||
}, | ||
_unbindEvent = function(setting) { | ||
|
@@ -2304,7 +2305,7 @@ | |
} | ||
})(jQuery); | ||
/* | ||
* JQuery zTree exedit v3.5.16-beta.2 | ||
* JQuery zTree exedit v3.5.16-beta.3 | ||
* http://zTree.me/ | ||
* | ||
* Copyright (c) 2010 Hunter.z | ||
|
@@ -2313,7 +2314,7 @@ | |
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* email: [email protected] | ||
* Date: 2013-11-03 | ||
* Date: 2013-11-24 | ||
*/ | ||
(function($){ | ||
//default consts of exedit | ||
|
@@ -2322,7 +2323,8 @@ | |
DRAG: "ztree_drag", | ||
DROP: "ztree_drop", | ||
REMOVE: "ztree_remove", | ||
RENAME: "ztree_rename" | ||
RENAME: "ztree_rename", | ||
DRAGMOVE:"ztree_dragmove" | ||
}, | ||
id: { | ||
EDIT: "_edit", | ||
|
@@ -2374,6 +2376,7 @@ | |
beforeEditName:null, | ||
beforeRename:null, | ||
onDrag:null, | ||
onDragMove:null, | ||
onDrop:null, | ||
onRename:null | ||
} | ||
|
@@ -2407,6 +2410,10 @@ | |
tools.apply(setting.callback.onDrag, [srcEvent, treeId, treeNodes]); | ||
}); | ||
|
||
o.bind(c.DRAGMOVE,function(event, srcEvent, treeId, treeNodes){ | ||
tools.apply(setting.callback.onDragMove,[srcEvent, treeId, treeNodes]); | ||
}); | ||
|
||
o.bind(c.DROP, function (event, srcEvent, treeId, treeNodes, targetNode, moveType, isCopy) { | ||
tools.apply(setting.callback.onDrop, [srcEvent, treeId, treeNodes, targetNode, moveType, isCopy]); | ||
}); | ||
|
@@ -2417,6 +2424,7 @@ | |
o.unbind(c.RENAME); | ||
o.unbind(c.REMOVE); | ||
o.unbind(c.DRAG); | ||
o.unbind(c.DRAGMOVE); | ||
o.unbind(c.DROP); | ||
}, | ||
//default event proxy of exedit | ||
|
@@ -2896,6 +2904,8 @@ | |
} | ||
preTmpTargetNodeId = tmpTargetNodeId; | ||
preTmpMoveType = moveType; | ||
|
||
setting.treeObj.trigger(consts.event.DRAGMOVE, [event, setting.treeId, nodes]); | ||
} | ||
return false; | ||
} | ||
|
Oops, something went wrong.