diff --git a/README.md b/README.md index e947d7196fe13516f893d4f03c6fbeaaafbede73..df0516ed4dcc16d2f0ac973c4e06d8bad8a3954c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ jQuery Tree Plugin ---- zTree ============ -last verson : 3.5.16-beta.2 +last verson : 3.5.16-beta.3 **Donate to zTree** : http://www.ztree.me/v3/donate.php diff --git a/api/apiCss/api.js b/api/apiCss/api.js index 84fb59ef00681b9863066a0c0f8447017171ee4a..37dd4ba3124919093505a938fdf1e1405afa29ab 100644 --- a/api/apiCss/api.js +++ b/api/apiCss/api.js @@ -58,7 +58,7 @@ var apiContent = { onNodeCreated: this.onNodeCreated, beforeClick: this.beforeClick } - } + }; var setting_nodes =[ {id:1, pId:0, t:"setting", name:"var setting = {", open:true}, {id:11, pId:1, t:"treeId", name:"treeId : \"\",", iconSkin:"core", showAPI:true}, @@ -99,8 +99,9 @@ var apiContent = { {id:3017, pId:30, t:"onCheck", name:"onCheck : null,", iconSkin:"check", showAPI:true}, {id:3018, pId:30, t:"onClick", name:"onClick : null,", iconSkin:"core", showAPI:true}, {id:3019, pId:30, t:"onCollapse", name:"onCollapse : null,", iconSkin:"core", showAPI:true}, - {id:3019, pId:30, t:"onDblClick", name:"onDblClick : null,", iconSkin:"core", showAPI:true}, + {id:3029, pId:30, t:"onDblClick", name:"onDblClick : null,", iconSkin:"core", showAPI:true}, {id:3020, pId:30, t:"onDrag", name:"onDrag : null,", iconSkin:"edit", showAPI:true}, + {id:3030, pId:30, t:"onDragMove", name:"onDragMove : null,", iconSkin:"edit", showAPI:true}, {id:3021, pId:30, t:"onDrop", name:"onDrop : null,", iconSkin:"edit", showAPI:true}, {id:3022, pId:30, t:"onExpand", name:"onExpand : null,", iconSkin:"core", showAPI:true}, {id:3023, pId:30, t:"onMouseDown", name:"onMouseDown : null,", iconSkin:"core", showAPI:true}, diff --git a/api/cn/setting.callback.onDrag.html b/api/cn/setting.callback.onDrag.html index f7e059799034e09ce902c571463987961c1fc101..efd115bda6dfafff661361534ea3032f5ac45a86 100644 --- a/api/cn/setting.callback.onDrag.html +++ b/api/cn/setting.callback.onDrag.html @@ -6,7 +6,7 @@

用于捕获节点被拖拽的事件回调函数

-

如果设置了 setting.callback.beforeDrag 方法,且返回 false,将无法触发 onDrag 事件回调函数。

+

如果设置了 setting.callback.beforeDrag 方法,且返回 false,将无法触发 onDragMove 和 onDrag 事件回调函数。

默认值:null

diff --git a/api/cn/setting.callback.onDragMove.html b/api/cn/setting.callback.onDragMove.html new file mode 100644 index 0000000000000000000000000000000000000000..e6a8dd9efc9a3b74cd4b857889f5f3675385c494 --- /dev/null +++ b/api/cn/setting.callback.onDragMove.html @@ -0,0 +1,34 @@ +
+
+

Function(event, treeId, treeNodes)setting.callback.onDragMove

+

概述[ 依赖 jquery.ztree.exedit 扩展 js ]

+
+

+
+

用于捕获节点被拖拽过程中移动的事件回调函数

+

主要用于捕获 zTree 节点拖拽到的 DOM,从而操作对应的 DOM。

+

默认值:null

+
+
+

Function 参数说明

+
+

eventjs event 对象

+

标准的 js event 对象

+

treeIdString

+

被拖拽的节点 treeNodes 所在 zTree 的 treeId,便于用户操控

+

treeNodesArray(JSON)

+

要被拖拽的节点 JSON 数据集合

+
+

setting & function 举例

+

1. 拖拽节点时,随时输出 当前拖拽到的目标 DOM

+
function zTreeOnDragMove(event, treeId, treeNodes) {
+    console.log(event.target);
+};
+var setting = {
+	callback: {
+		onDragMove: zTreeOnDragMove
+	}
+};
+......
+
+
\ No newline at end of file diff --git a/api/en/setting.callback.onDrag.html b/api/en/setting.callback.onDrag.html index 30c738d76d66bc859ce523e1ab133577b80f7a99..d178b635e139b96716f7e756430b3727e6bcd500 100644 --- a/api/en/setting.callback.onDrag.html +++ b/api/en/setting.callback.onDrag.html @@ -6,7 +6,7 @@

Used to capture the drag event when drag node.

-

If you set 'setting.callback.beforeDrag',and return false, zTree will stop drag, and will not trigger the 'onDrag' callback.

+

If you set 'setting.callback.beforeDrag',and return false, zTree will stop drag, and will not trigger the 'onDragMove' & 'onDrag' callback.

Default: null

diff --git a/api/en/setting.callback.onDragMove.html b/api/en/setting.callback.onDragMove.html new file mode 100644 index 0000000000000000000000000000000000000000..a56e83534c403298dae4ae1c7916fecb7fbe10fc --- /dev/null +++ b/api/en/setting.callback.onDragMove.html @@ -0,0 +1,34 @@ +
+
+

Function(event, treeId, treeNodes)setting.callback.onDragMove

+

Overview[ depends on jquery.ztree.exedit js ]

+
+

+
+

Used to capture the drag-move event when drag & drop node.

+

Mainly used to capture the DOM which the nodes was drag in.

+

Default: null

+
+
+

Function Parameter Descriptions

+
+

eventjs event Object

+

event Object

+

treeIdString

+

zTree unique identifier: treeId, the tree is what the treeNodes are belong to, easy for users to control.

+

treeNodesArray(JSON)

+

A collection of the nodes which will be dragged

+
+

Examples of setting & function

+

1. When drag nodes, output the target dom.

+
function zTreeOnDragMove(event, treeId, treeNodes) {
+	console.log(event.target);
+};
+var setting = {
+	callback: {
+		onDragMove: zTreeOnDragMove
+	}
+};
+......
+
+
\ No newline at end of file diff --git a/demo/cn/super/dragWithOther.html b/demo/cn/super/dragWithOther.html index 04a5b7c440aa9bc069cd2bbd9e16b4a74bdd9aed..91e80e88ea849ff2cc3b7ca3bf574c9736705212 100644 --- a/demo/cn/super/dragWithOther.html +++ b/demo/cn/super/dragWithOther.html @@ -32,6 +32,22 @@ innerTree: function(treeId, treeNodes, targetNode) { return targetNode!=null && targetNode.isParent && targetNode.tId == treeNodes[0].parentTId; }, + dragMove: function(e, treeId, treeNodes) { + var p = null, pId = 'dom_' + treeNodes[0].pId; + if (e.target.id == pId) { + p = $(e.target); + } else { + p = $(e.target).parent('#' + pId); + if (!p.get(0)) { + p = null; + } + } + + $('.domBtnDiv .active').removeClass('active'); + if (p) { + p.addClass('active'); + } + }, dropTree2Dom: function(e, treeId, treeNodes, targetNode, moveType) { var domId = "dom_" + treeNodes[0].getParentNode().id; if (moveType == null && (domId == e.target.id || $(e.target).parents("#" + domId).length > 0)) { @@ -171,6 +187,7 @@ callback: { beforeDrag: MoveTest.dragTree2Dom, onDrop: MoveTest.dropTree2Dom, + onDragMove: MoveTest.dragMove, onMouseUp: MoveTest.dom2Tree }, view: { @@ -201,6 +218,7 @@ .domBtn {display:inline-block;cursor:pointer;padding:2px;margin:2px 10px;border:1px gray solid;background-color:#FFE6B0} .domBtn_Disabled {display:inline-block;cursor:default;padding:2px;margin:2px 10px;border:1px gray solid;background-color:#DFDFDF;color:#999999} .dom_tmp {position:absolute;font-size:12px;} +.active {background-color: #93C3CF} @@ -215,7 +233,7 @@