我想检索 的父级child node而不单击tree..
data.inst._get_parent(data.rslt.obj).attr("id");
Run Code Online (Sandbox Code Playgroud)
当我们单击 时,上面的命令给我直接父级child nodes。
有没有一种方法可以parent node在不点击的情况下获得child node.
问候, 普拉克 M
似乎“data.inst”在新版本中已重命名为“data.instance”。这使得追踪解决方案变得困难
data.instance.get_parent(data.node)返回父级的字符串 ID(对我来说出乎意料)。为了获取父级,我必须调用data.instance.get_node()字符串 ID。
data.instance.get_parent(data.node)也可以通过 data.node.parent 访问。
例子:
$('#MaterialCollectionTree').on('activate_node.jstree', function(e, data) {
if(data.instance.is_leaf(data.node)) {
alert("Leaf: " + data.node.text);
alert("Parent: " + data.instance.get_node(data.node.parent).text);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24791 次 |
| 最近记录: |