Results 1 to 3 of 3

Thread: Tree navigation - me.dom.parentNode is undefined

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    66
    Vote Rating
    1
      0  

    Default Tree navigation - me.dom.parentNode is undefined

    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);
                    }
                }            
            }

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,367
    Vote Rating
    858
      0  

    Default

    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!

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    66
    Vote Rating
    1
      0  

    Default

    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);
        },

Tags for this Thread

Posting Permissions

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