ztree
程序员文章站
2022-06-12 09:16:15
...
获取全部节点数据:
var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getNodes();
节点拖拽:
callback: {
beforeDrag: beforeDrag,
beforeDrop: beforeDrop
}
function beforeDrag(treeId, treeNodes) {
for (var i=0,l=treeNodes.length; i<l; i++) {
if (treeNodes[i].drag === false) {
return false;
}
}
return true;
}
function beforeDrop(treeId, treeNodes, targetNode, moveType) {
//扩展 只有一个根节点
var node = targetNode.getParentNode();
if(null!=node){
return targetNode ? targetNode.drop !== false : true;
}else{
return false;
}
//return targetNode ? targetNode.drop !== false : true;
}
上一篇: 笑话集原创笑话精品展第178期