Results 1 to 5 of 5

Thread: Ext.panel.Tree: Cannot read property 'firstChild' of undefined

  1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    1

    Default Ext.panel.Tree: Cannot read property 'firstChild' of undefined

    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:
    Code:
    Uncaught TypeError: Cannot read property 'firstChild' of undefined.
    The code of the treepanel is as follows:
    Code:
       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?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    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.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Answers
    102

    Default

    I would suggest looking at whether or not you're sharing the same store instance.

  4. #4

    Default same problem

    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!

  5. #5
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    114
    Answers
    5

    Default

    Quote Originally Posted by mitchellsimoens View Post
    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:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •