ztree获取节点对象?急...
objTree.children;中objTree为节点对象,要怎么表示当前被选中节点对象(相当于$this,不是节点数据集啊)...
objTree.children;中objTree为节点对象,要怎么表示当前被选中节点对象(相当于$this,不是节点数据集啊)
展开
1个回答
展开全部
var setting = {
data: {
simpleData: {
enable: true
}
},
callback: {
onClick: onClick
}
};
function onClick(event, treeId, treeNode,clickFlag) {
alert(treeNode.tId + ", " + treeNode.name);//点击直接返回节点对象treeNode
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
//var nodes = zTree.getNodes();
var nodes = zTree.getSelectedNodes();
alert(nodes[0].name);//返回被选中节点对象
};
data: {
simpleData: {
enable: true
}
},
callback: {
onClick: onClick
}
};
function onClick(event, treeId, treeNode,clickFlag) {
alert(treeNode.tId + ", " + treeNode.name);//点击直接返回节点对象treeNode
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
//var nodes = zTree.getNodes();
var nodes = zTree.getSelectedNodes();
alert(nodes[0].name);//返回被选中节点对象
};
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询