ztree 根据id选中某一点且触发当前点的click事件

<ul id="treeCity" class="ztree"></ul>


leftztree : function(){
$.ajax({
url : commonFunction.config.leftztreeUrl,
dataType : "json",
type : "POST",
async : false,
success : function(data) {
zNodes = data;
$.fn.zTree.init($("#treeCity"), setting, zNodes);
},
error : function(data)// 服务器响应失败处理函数
{
console.log("服务器异常");
}
});
},
var setting = {
view: {
selectedMulti: false,
showIcon: false ,
addHoverDom: addHoverDom,
removeHoverDom: removeHoverDom
},
check: {
enable: true,
chkStyle: "checkbox"
},
data: {
simpleData: {
enable: true
}
},
/*点击事件*/
callback: {
beforeClick: zTreeBeforeClick,
onclick:zTreeBeforeClick
}
};


var zTree = $.fn.zTree.getZTreeObj("treeCity");
var node = zTree.getNodeByParam("id",fileSucessdData[0].rid);
zTree.selectNode(node);
$("#"+node.tId+"_span").click();
posted on 2019-02-13 10:52  忆小样  阅读(1837)  评论(0编辑  收藏  举报