Ext version tested:
  • Ext 4.1.1-rc1
Browser versions tested against:
  • FF13
Description:
  • This is a very difficult one to reproduce... but it only occurs when adding many nodes and child nodes at once
  • The error also only appears depending on the size of tree - a big tree didnt create this error - only a smaller one as in the next step of this post
Steps to reproduce the problem:
  • Create a tree and add the following structure at once from an array - not on button click or so
  • Node 1
    • Node 1.1
      • Node 1.2
  • Node 2
    • Node 2.1
      • Node 2.2
  • -- continue until 5.2
The result that was expected:
  • Tree is displayed correctly
The result that occurs instead:
  • cashes with 'me.dom.parentNode is undefined'
I had found a temporary solution using
Code:
parentNode.insertChild(parentNode.childNodes.length, childNode );
instead of that
Code:
parentNode.appendChild(childNode);
or vice versa... however that stopped working in the end for me.

My final fix is to alter the ExtJS Lib:

Under
Code:
Ext.dom.AbstractElement.addMethods({
for function
Code:
insertSibling: function(el, where, returnDom){
change
Code:
if(el.nodeType || el.dom){
                rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : 
                if (!returnDom) {
                    rt = Ext.get(rt);
                }
            }            
        }
to
Code:
if(el.nodeType || el.dom){
            if(me.dom.parentNode){
                rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : me.dom);
                if (!returnDom) {
                    rt = Ext.get(rt);
                }
            }            
        }