View Full Version : Elements removed or duplicated when reopen panel

28 Dec 2010, 7:35 AM
Hi all, I've been trying to resolve an issue this week unsuccessfully. I have a ViewPort containing a TreePanel with options at left hand, and each option opens a Panel at left hand. One of them is behaving weird: when you click at the item in tree, the first time it opens fine, but if you click it once again the toolbar dissapears, and if you click once again, all ComboBoxes and TextFields are duplicated!!

I checked autoDestroy property to remove panel from DOM, but not sure if I have to add something else :s. This is the portion of code for tree opening panels:

if (centralPanel.items.length > 0) centralPanel.removeAll(true);

centralPanel.add(new Ext.Panel({
id: n.id, // param from DB
url: n.url, // param from DB
scripts: true
border: false,
closable: true,
autoDestroy: true,
text: 'Loading...',
title: '<div align="center">' + n.id.split(';')[1] + '</div>',
width: '100%'

Any idea? Thanks in advance.

28 Dec 2010, 7:41 AM
Don't autoLoad Ext components!

The container has no knowledge of those components, so it doesn't know that they should be destroyed when the container is destroyed.

Do you really need to load components dynamically (it's usually a lot slower than including all javascript in a single concatenated, minified and gzipped file once)?

If yes, then consider using LiteRemoteComponent instead.

28 Dec 2010, 7:45 AM
Why shouldn't you use autoLoad in a panel?

I think the problem is that he's got multiple panels where n.id is the same. Two or more Ext components shouldn't have the same ID... When you do have two components with the same ID, the behavior is what he describes.

If anything, he might consider using an IFrame vs. loading his HTML from the server into the Panel.

28 Dec 2010, 8:02 AM
Hi mschwartz. I only have one panel at right hand, I remove all before loading a new panel, however, I tried removing id. Maybe I could try with IFrame as well.

Hi condor. I'm going to try LiteRemoteComponent, could IFrame be lighter than LiteRemoteComponent?


28 Dec 2010, 8:04 AM
No, an IFRAME is almost certainly heavier than LiteRemoteComponent. It does however have the advantage of being a different frame (e.g. own styling etc.).