View Full Version : TreePanel.getRootNode().expand() issue

17 Feb 2010, 5:58 AM
Hi, (SOMETIMES) i'm facing a strange error when trying to call the
TreePanel.getRootNode().expand() method.
The boring thing is the fact that it apperas accidentaly once every 5 or 6 page refreshes.

What i mean:
I have a treePanel config object like this:

var Accordion_2_Cfg = new Object ({
xtype: 'treepanel', title: 'Products', id: 'Acc_Faults', rootVisible: true,
useArrows: true, autoScroll: true, animate: true, enableDD: false, containerScroll: true,
dataUrl: 'scripts/accordion/php/populate_trees.php',
root: { text: 'TopMother', draggable: false, id: 'node_0', checked: false}
This config is then used in an Accordion panel like this:

var C2K_Accordion = new Ext.Panel({

title: 'Report Config',
id: 'Accordion_panel', region:'west', frame: true,
layout: 'accordion', margins: '0 0 0 0',
width: 175, minSize: 100, maxSize: 250,
collapsible: true,
layoutConfig: {animate: true, activeOnTop: false},

});Finally, this accordion panel is placed in a region within a window with border layout (the window definition is not posted here, i could provide it if needed).

Immediately after the above panel definition i have a line like this:

Ext.getCmp('Acc_Faults').getRootNode().expand();And this is working in 5 out of 6 times when i refresh the page.

But sometimes (i can't figure out any dependance when/why), Firebug shows me the following error in ext-all-debug.js (line 50843) (Ext version 3.1.1):

"targetNode is undefined"

The line within the ext-all-debug.js is:

targetNode.appendChild(this.wrap);Consequently, the tree node is not of course expanded :(

No code changes, nor any script changes - i just refresh the page in Firefox and this error comes in sometimes.

And this happens in IE8, FF3.6, Opera 9, and Chrome.

The only browser that is working with that code without issues is Opera 10.10 - it never showed any issues and is rendering the stuff significally faster than others.

It's very annoying issue and i'm unable to resolve it for more than several hours.

Any suggestions, folks?


Other strange thing is that i can't get to show the scrollbars of the above treePanel with IE8 - they appear in the other browsers, but not in IE8. But this is separate stuff...

18 Feb 2010, 5:04 AM
Well, it seems that the problem came from the fact that the tree panel contained nodes with duplicate ids.
I noticed this too late :(
Removing this bug corrected the issue.