n.dee
n.dee

Reputation: 371

ExtJS4: Find DOM element of tree node

I want to run automated UI tests in my ExtJS4 application. I don't want to use Siesta, the Testing Tool from Sencha. Instead, I want to use a custom tool.

The application uses a TreePanel. To support the automated UI test, it is mandatory that each treenode (Ext.data.NodeInterface) has a unique and language independent identifier as attribute in its HTML representation.

This identifier should be set at the treenode when added to the tree. A custom ExtJS plugin for the treepanel should then render the identifier from the treenode object to its HTML representation.

So, my problem is: How do I get the DOM element of an Ext.data.NodeInterface?

Thanks in advance.

Upvotes: 4

Views: 4380

Answers (1)

dbrin
dbrin

Reputation: 15673

If you know the record ID of the node you are trying to target then you can try the following:

var myNode = tree.getStore().getNodeById(id);
var nodeElement = tree.getView().getNode(myNode);

Upvotes: 6

Related Questions