bpromas
bpromas

Reputation: 694

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. I am validating these input fields using jquery validate and I intend on getting the invalid elements through their .error class. 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?

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.

Upvotes: 1

Views: 417

Answers (1)

mar10
mar10

Reputation: 14794

You could try this (untested):

errElements = $(".error");
firstNode = $.ui.fancytree.getNode(errElements[0]);

Upvotes: 2

Related Questions