[英]Fancytree: Possible to get a table node from its element?
I have a large and complex fancytree that uses ext-table in which the first column is the node title and the second is an <input>
field. 我有一个使用ext-table的大型复杂花式树,其中第一列是节点标题,第二列是
<input>
字段。 I am validating these input fields using jquery validate and I intend on getting the invalid elements through their .error
class. 我正在使用jquery validate验证这些输入字段,并且打算通过它们的
.error
类获取无效元素。 After that I would like to be able to get the node that this element belongs to so I can alert the user exactly what node was invalid, or perhaps trace out a path of how to get to that node. 之后,我希望能够获得该元素所属的节点,以便我可以准确地警告用户哪个节点无效,或者找出如何到达该节点的路径。
So my question is, given an input element is there a way I can get its fancytree node? 所以我的问题是,给定一个input元素,有没有一种方法可以获取其fancytree节点?
The best I can currently do is 我目前能做的最好的事情是
$(".error").focus();
node = tree.getActiveNode();
But this requires my node to be visible, which it won't always be. 但这要求我的节点是可见的,但它并不总是可见的。
You could try this (untested): 您可以尝试以下操作(未经测试):
errElements = $(".error");
firstNode = $.ui.fancytree.getNode(errElements[0]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.