View Full Version : Tree View - referring to Nodes programatically

17 Oct 2012, 7:04 AM
I have defined a TreeView, and when it gets rendered to the HTML page, the first element is a DIV with the id of my TreeView:

<div id="levelTreePanel" class="x-panel x-tree-panel x-tree-lines x-grid x-grid-header-hidden x-panel-default" style="height: 120px; width: 320px; " role="presentation">

There are some nested DIVs under that, with Id's like 'treeview-xxxx' and 'ext-genxxxx'
Then there's a TABLE
In cells of the table are Divs that render each of the Nodes in my Tree data.
I would like to be able to reference these Divs that represent my Nodes from Javascript, but the generated Node-Divs don't have Ids at all. I've tried assigning 'id' attributes to the nodes of the Tree data, but these don't get rendered anywhere on the resulting HTML.

Is there a way to get the framework to assign Id values to the Nodes of the tree?

22 Oct 2012, 9:09 AM
What are you actually trying to accomplish?

22 Oct 2012, 5:44 PM
Try this:

function getDivRef (nodeId){ // nodeId is record Id
var divRef = null;
var node = treeStore.getNodeById(nodeId);
node = treePanel.getView().getNode(node);
divRef = Ext.fly(node).down('div');
return divRef;