PDA

View Full Version : Ext.panel.Tree: Cannot read property 'firstChild' of undefined



dewey
1 Nov 2011, 2:19 AM
Hello all,

I'm using a treepanel and the first time the view is openend with a treepanel inside of it there are no problems. Subfolders are opening, drag drop is working etc.

After I remove the parent view and open it again the treepanel looks alright but the subfolders wont' open. The error:
Uncaught TypeError: Cannot read property 'firstChild' of undefined.

The code of the treepanel is as follows:

this.items = [{
xtype: 'treepanel',
store: 'Folders',
title: 'Folders',
draggable: true,
flex: 1,
margins: '0 10 0 0',
tbar: tbar,
listeners: {
selectionchange: function(selModel, selections){
this.down('#edit-folder').setDisabled(selections.length === 0);
this.down('#delete-folder').setDisabled(selections.length === 0);
}
},
columns: [
{
xtype: 'treecolumn',
text: 'Name',
sortable: true,
flex: 3,
dataIndex: 'name'
}
]
}];


Does someone know what I'm doing wrong?

mitchellsimoens
16 Nov 2011, 11:48 AM
Are you destroying the component when you remove it? If you are destroying it then things won't work properly. You need to remove it but not destroy it.

16 Nov 2011, 7:14 PM
I would suggest looking at whether or not you're sharing the same store instance.

christatos
7 Dec 2011, 8:38 AM
Hi, I have the same problem.
I have verified that my store still is the same... what element you say that have been destroyed?
Thanks!

kclendinning
21 Mar 2012, 8:59 PM
Are you destroying the component when you remove it? If you are destroying it then things won't work properly. You need to remove it but not destroy it.


do you mean in the whole tree, if you deleting or moving we shouldnt destroy to remove the component, we should remove? here is my move code, whenever i do a move i get this error: