Issue 310: Loading animation never ends using lazy read on empty folder
Status:  Done
Owner: ----
Closed:  May 2012
Reported by dev.todo...@gmail.com, May 9, 2012
What steps will reproduce the problem?
1.Create the following tree:

$("#tree").dynatree({
                        onLazyRead: function(node){
                             myajaxcall(params,
                                        function(response){
            				    children = response.result.children;
                                            var i = 0;
        				    while(child=children[i++])
                                                node.addChild(child, null);
        				}
                             );
                        },
                        autoFocus: false,
                        persist: false,
                        children: root  // initial content
});

What is the expected output? What do you see instead?

When "children" response is empty and node.addChild(...) is never called, loading animation doesn't stop correctly. If at least one child is added, everything works fine.

I added this work around:
                        onLazyRead: function(node){
                             myajaxcall(params,
                                        function(response){
            				    children = response.result.children;
                                            var i = 0;
        				    while(child=children[i++])
                                                node.addChild(child, null);
                                            // Work around to stop loading animation.
                                            if (children.length == 0)
                                                node.setLazyNodeStatus(DTNodeStatus_Ok);
        				}
                             );
                        },

What version of the dynatree and jQuery are you using?
jquery: 1.7.2
jquery-ui: 1.8.7
dynatree: $Version: 1.2.0$ $Revision: 528, 2011-09-17 18:58:59$

On what operating system and browser?
OS: Ubuntu Linux
Browser: Firefox 12.0

What DOCTYPE declaration are you using?
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Please provide any additional information below.

May 11, 2012
Project Member #1 moo...@wwwendt.de
did you try node.setLazyNodeStatus()?
 (See 5.5.1 Loading custom formats in the docs)
Status: Waiting
Labels: Milestone-Release1.2.1
May 12, 2012
#2 dev.todo...@gmail.com
I did it. I added node.setLazyNodeStatus(DTNodeStatus_Ok); and it is working now. However it should not behave differently if i add or not a child, right?
May 13, 2012
Project Member #3 moo...@wwwendt.de
thats true. the next major release will be more robust on this.
Status: Done