Michael
Michael

Reputation: 163

Complete event for Dynatree/Fancytree initialization and Ajax loading?

I need a way to detect if the tree has loaded or if the adding of the new nodes has completed programmatically or if the loading by ajax has completed. So far I could not find any callback/event to do this.

postProcess event does not seems to help either. Any help?

Upvotes: 3

Views: 3793

Answers (1)

Lethal Left Eye
Lethal Left Eye

Reputation: 378

Just add the "complete" clause to your ajax request. It would look something like this:

$("#fileTree").fancytree({
        source : $.ajax({
            type : "GET",
            url : 'http://localhost:8080' + '/MyRoute',
            dataType : 'json',
            complete : function() {
                $("#fileTree").fancytree("getRootNode").sortChildren(null, true);
            }
})

Here are two links that may help you: jQuery AJAX - Do Stuff in Success or Complete callbacks? http://api.jquery.com/ajaxcomplete/

Upvotes: 3

Related Questions