Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'tr' of undefined after extand node with empty array of childrens. #531

Closed
akabynga opened this issue Dec 7, 2015 · 1 comment

Comments

@akabynga
Copy link

akabynga commented Dec 7, 2015

I think, will be cool to add checking for empty array of children cause I got error on following function:

function findPrevRowNode(node){
    var i, last, prev,
        parent = node.parent,
        siblings = parent ? parent.children : null;

    if(siblings && siblings.length > 1 && siblings[0] !== node){
        // use the lowest descendant of the preceeding sibling
        i = $.inArray(node, siblings);
        prev = siblings[i - 1];
        _assert(prev.tr);
        // descend to lowest child (with a <tr> tag)
        while(prev.children){
            last = prev.children[prev.children.length - 1];
            if(!last.tr){
                break;
            }
            prev = last;
        }
    }else{
        // if there is no preceding sibling, use the direct parent
        prev = parent;
    }
    return prev;
}

while(prev.children) change to  while(prev.children && prev.children.length > 0)

Thanks.

@mar10
Copy link
Owner

mar10 commented Dec 12, 2015

Could you please give some details, when this problem occurs, i.e. what is the tree structure when you expand?
(I would like to reproduce the error before I apply a fix.)
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants