zTree,默认选中

原创 李仁伟前端笔记 随笔 js 320阅读 2017-12-06 13:54:53 举报

var zTreeSelect = $.fn.zTree.getZTreeObj("zTree");
//获取已经选中的复选框
var checkedNodes = zTreeSelect.getCheckedNodes(true);
//禁用所有复选框
var nodes = zTreeSelect.getNodes();
for (var i = 0, l = nodes.length; i < l; i++) {
zTreeSelect.setChkDisabled(nodes[i], true);
}

/ztree 进行操作/

function knowledgeNodesNameStr(node) {
if (node.getParentNode() != null) {
if (parentStr == '') {
parentStr = node.id;
} else {
parentStr = node.id + ' , ' + parentStr;
}
knowledgeNodesNameStr(node.getParentNode());
} else {
if (parentStr == '') {
parentStr = node.id;
} else {
parentStr = node.id + ' , ' + parentStr;
}
}
}

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复