Topic: Error on Mouse over/out when the node is not yet loaded

I get a error 'null is null or not an object'  when I move mouse in the container where the tree is being loaded.

This is caused because, in the over & out method of Mif.Tree.Hover class it calls the node.getDOM('wrapper') method but as the node is not yet created( the json is being loaded ) it generates error on the bold line in the code below.

getDOM: function(what){
        var node=$(this.tree.DOMidPrefix+this.UID);
        if(what=='node') return node;
              // THE node  IS NULL HERE AS IT IS NOT YET CREATED
        var wrapper=node.getFirst();
        if(what=='wrapper') return wrapper;
        if(what=='children') return wrapper.getNext();
        return wrapper.getElement('.mif-tree-'+what);
    },

Moro is there any way to prevent this?

Last edited by Sanjay (2009-05-11 12:56:40)

Thumbs up Thumbs down

Re: Error on Mouse over/out when the node is not yet loaded

can't reproduce, demo pls.

Re: Error on Mouse over/out when the node is not yet loaded

sorry moro , the reason for the error is not the load but the remove.

Before I load/reload the tree, I remove the content of existing tree( if exist ) by using following code.


if (tree.root)
{
    tree.root.remove();
}

tree.load ( { url:'http://.....'} );

Now I assume that while the tree contents are being removed and If I mouse the mouse over the container I will get this error.  right?

I also tried to remove the tree contents using

tree.wrapper.getLast().destroy().

But doesnt help.

Is there a way to stop hover event while the tree is removed.? Or is there any other way to prevent this?

Thumbs up Thumbs down

Re: Error on Mouse over/out when the node is not yet loaded

fixed rev94

Re: Error on Mouse over/out when the node is not yet loaded

that was quick :-) , works as desired.. thanks moro

Thumbs up Thumbs down