提交 0dd61354 编写于 作者: Z ztree

remove the 'event' parameter in 'onSelected/onUnSelected' callback. And when...

remove the 'event' parameter in 'onSelected/onUnSelected' callback.  And when you remove the node which be selected, zTree will trigger the 'onUnSelected' callback.
上级 e7f2a026
此差异已折叠。
......@@ -9,7 +9,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
var settings = {}, roots = {}, caches = {},
......@@ -184,11 +184,11 @@
tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
});
o.bind(c.SELECTED, function (event, srcEvent, treeId, node) {
tools.apply(setting.callback.onSelected, [srcEvent, treeId, node]);
o.bind(c.SELECTED, function (event, treeId, node) {
tools.apply(setting.callback.onSelected, [treeId, node]);
});
o.bind(c.UNSELECTED, function (event, srcEvent, treeId, node) {
tools.apply(setting.callback.onUnSelected, [srcEvent, treeId, node]);
o.bind(c.UNSELECTED, function (event, treeId, node) {
tools.apply(setting.callback.onUnSelected, [treeId, node]);
});
},
_unbindEvent = function(setting) {
......@@ -564,6 +564,7 @@
for (var i=0, j=root.curSelectedList.length; i<j; i++) {
if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
root.curSelectedList.splice(i, 1);
setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]);
i--;j--;
}
}
......@@ -1001,11 +1002,10 @@
$$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED);
if (node) {
data.removeSelectedNode(setting, node);
setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]);
break;
} else {
list.splice(i, 1);
setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]);
setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]);
}
}
}
......@@ -1399,7 +1399,7 @@
}
$$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
data.addSelectedNode(setting, node);
setting.treeObj.trigger(consts.event.SELECTED, [event, setting.treeId, node]);
setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]);
},
setNodeFontCss: function(setting, treeNode) {
var aObj = $$(treeNode, consts.id.A, setting),
......@@ -1725,7 +1725,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
//default consts of excheck
......@@ -2353,7 +2353,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
//default consts of exedit
......
此差异已折叠。
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
var settings = {}, roots = {}, caches = {},
......@@ -183,11 +183,11 @@
tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
});
o.bind(c.SELECTED, function (event, srcEvent, treeId, node) {
tools.apply(setting.callback.onSelected, [srcEvent, treeId, node]);
o.bind(c.SELECTED, function (event, treeId, node) {
tools.apply(setting.callback.onSelected, [treeId, node]);
});
o.bind(c.UNSELECTED, function (event, srcEvent, treeId, node) {
tools.apply(setting.callback.onUnSelected, [srcEvent, treeId, node]);
o.bind(c.UNSELECTED, function (event, treeId, node) {
tools.apply(setting.callback.onUnSelected, [treeId, node]);
});
},
_unbindEvent = function(setting) {
......@@ -563,6 +563,7 @@
for (var i=0, j=root.curSelectedList.length; i<j; i++) {
if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
root.curSelectedList.splice(i, 1);
setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]);
i--;j--;
}
}
......@@ -1000,11 +1001,10 @@
$$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED);
if (node) {
data.removeSelectedNode(setting, node);
setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]);
break;
} else {
list.splice(i, 1);
setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]);
setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]);
}
}
}
......@@ -1398,7 +1398,7 @@
}
$$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
data.addSelectedNode(setting, node);
setting.treeObj.trigger(consts.event.SELECTED, [event, setting.treeId, node]);
setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]);
},
setNodeFontCss: function(setting, treeNode) {
var aObj = $$(treeNode, consts.id.A, setting),
......
此差异已折叠。
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
//default consts of excheck
......
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
......
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
//default consts of exedit
......
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function(w){var I={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(C.dragFlag==0&&Math.abs(N-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(O-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(C.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)C.dragNodeShowBefore=
......
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function($){
//default init node of exLib
......
......@@ -8,7 +8,7 @@
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-08-13
* Date: 2015-08-26
*/
(function(i){i.extend(!0,i.fn.zTree._z,{view:{clearOldFirstNode:function(c,a){for(var b=a.getNextNode();b;){if(b.isFirstNode){b.isFirstNode=!1;d.setNodeLineIcos(c,b);break}if(b.isLastNode)break;b=b.getNextNode()}},clearOldLastNode:function(c,a,b){for(a=a.getPreNode();a;){if(a.isLastNode){a.isLastNode=!1;b&&d.setNodeLineIcos(c,a);break}if(a.isFirstNode)break;a=a.getPreNode()}},makeDOMNodeMainBefore:function(c,a,b){c.push("<li ",b.isHidden?"style='display:none;' ":"","id='",b.tId,"' class='",l.className.LEVEL,
b.level,"' tabindex='0' hidefocus='true' treenode>")},showNode:function(c,a){a.isHidden=!1;f.initShowForExCheck(c,a);j(a,c).show()},showNodes:function(c,a,b){if(a&&a.length!=0){var e={},g,k;for(g=0,k=a.length;g<k;g++){var h=a[g];if(!e[h.parentTId]){var i=h.getParentNode();e[h.parentTId]=i===null?f.getRoot(c):h.getParentNode()}d.showNode(c,h,b)}for(var j in e)a=e[j][c.data.key.children],d.setFirstNodeForShow(c,a),d.setLastNodeForShow(c,a)}},hideNode:function(c,a){a.isHidden=!0;a.isFirstNode=!1;a.isLastNode=
......
......@@ -13,7 +13,8 @@
</font>
*2015.08.13* v3.5.18
*2015.08.26* v3.5.18
* 【修改】onSelected/onUnSelected 回调参数,由 (event, treeId, node) 修改为 (treeId, node);另外 删除 已选择的节点时,也会触发 onUnSelected 回调
* 【增加】Allow nodes to specify their own icon using an 'icon' property of the 'setting.data.key'
* 【增加】metro 风格 demo
* 【增加】awesome 风格 demo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册