PDA

View Full Version : Highlighting (Ext.Fx) a selected treenode



karga
8 Jul 2009, 4:39 AM
Hi,

I'm trying to highlight (using the Ext.Fx) a treenode, but when that treenode is selected upon highlight, the effect isn't showing. I've found out, that the element I'm highlighting is the LI-item, that gets overridden by the background-color of the child div.x-tree-selected

I'm doing this:

objTreeNode = Ext.getCmp('pagestree').getNodeById(1)
Ext.get(objTreeNode.getUI().getEl()).highlight()

Does anyone know of a way to get the actual div.x-tree-node-el? I've tried something like findByType('x-tree-node-el'), but that's supposedly not a function - at least not to the object im using it on

Animal
8 Jul 2009, 4:49 AM
get the El of the UI, and use http://extjs.com/deploy/dev/docs/?class=Ext.Element&member=up

karga
8 Jul 2009, 4:56 AM
Wouldn't that go UP the DOM?

The LI is the parent of the div i want to add the highlight to


<li class="x-tree-node" id="ext-gen69" style="visibility: visible;">
<div unselectable="on" class="x-tree-node-el x-tree-node-leaf x-unselectable x-tree-selected" ext:tree-node-id="2">
<span class="x-tree-node-indent"/>
<img class="x-tree-ec-icon x-tree-elbow" src="scripts/extjs/resources/images/default/s.gif"/>
<img unselectable="on" class="x-tree-node-icon print" src="scripts/extjs/resources/images/default/s.gif"/>
<a tabindex="1" href="" class="x-tree-node-anchor" hidefocus="on">
<span unselectable="on">
Nodetitle
</span>
</a>
</div>
<ul style="display: none;" class="x-tree-node-ct"/>
</li>

Animal
8 Jul 2009, 5:01 AM
I don't know what getUI.getEl() returns

Either use up or child depending on which way you want to go

karga
8 Jul 2009, 5:05 AM
Thanks, i'll try that in a minute :) the GetUI().getEl() returns the LI

I'll return if isn't working

karga
8 Jul 2009, 5:50 AM
It worked :) for others to use, the code was:

Ext.get(objTreeNode.getUI().getEl()).child('div.x-tree-node-el').highlight("FFFFFF")

Works very nice on the tree in conjunction with

Ext.get(objTreeNode.getUI().getEl()).frame("0000FF")

Gonfi
4 Aug 2009, 9:43 AM
is there a "clean" way?