-
21 Jun 2012 12:29 AM #1
Tree navigation - me.dom.parentNode is undefined
Tree navigation - me.dom.parentNode is undefined
Ext version tested:
- Ext 4.1.1-rc1
- FF13
- 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
- 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 1.1
- Node 2
- Node 2.1
- Node 2.2
- Node 2.1
- -- continue until 5.2
- Tree is displayed correctly
- cashes with 'me.dom.parentNode is undefined'
instead of thatCode:parentNode.insertChild(parentNode.childNodes.length, childNode );
or vice versa... however that stopped working in the end for me.Code:parentNode.appendChild(childNode);
My final fix is to alter the ExtJS Lib:
Under
for functionCode:Ext.dom.AbstractElement.addMethods({
changeCode:insertSibling: function(el, where, returnDom){
toCode:if(el.nodeType || el.dom){ rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : if (!returnDom) { rt = Ext.get(rt); } } }
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); } } }
-
21 Jun 2012 12:35 AM #2
Impossible to tell without a test case, I'd say the problem, whether yours or ours, lies elsewhere, not in that core code.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
21 Jun 2012 12:47 AM #3
thanks for your reply - I will try and get a test case on here as soon as possible. However it only happens when i'm inserting a child node. Linear is fine... and if I add the if() statement in the core code, everything works just as it should.
my insert function
Code:var parentNode = this.getANodeByID(parentID); if(parentNode){ var childNode = this.getANodeByID(childID); if(childNode){ //parentNode.insertChild(parentNode.childNodes.length, childNode ); //parentNode.appendChild(childNode); } }
my getANodeByID function
Code:getANodeByID: function(itemID){ return this.getNavigatorTree().getStore().getNodeById("nav_" + itemID); },
Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.


Reply With Quote