Oleksandr
Oleksandr

Reputation: 5668

Dynatree returns error when faced with more than 2000 items

I use dynatree and everything works fine but if a node has large number of items I get an error. I have read about setting enableUpdate(false); function but it also didn't help. Any ideas?

var serviceParams = { Type: this._fieldName };

$("#tree").dynatree({       
    autoFocus: false,
    clickFolderMode: 1,     
    initAjax: {
        url: tree._serviceUrl + "/top",
        data: jQuery.serializeJSON(serviceParams),
        type: "POST",
        contentType: "application/json; charset=utf-8",
        dataType: "json"
    },

    onLazyRead: function(node) {        

        //this.enableUpdate(false);    

        var serviceParamsForChildren = 
        { 
            Type: tree._fieldName, 
            parentId: node.data.key, 
            includeDescedants: false 
        };

        node.appendAjax({
            url: tree._serviceUrl + "/Children",
            data: jQuery.serializeJSON(serviceParamsForChildren),
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: "json"
        });

        //this.enableUpdate(true);
    },
    onActivate: function(node) {
       tree._selectedNode = node;
    }
});

Upvotes: 2

Views: 953

Answers (1)

oleksii
oleksii

Reputation: 35925

As per docs

tree.enableUpdate(enable)

Turn rendering on or off and return the previous mode. Disabling update may speedup processing, when adding lots of nodes. Don't forget to turn rendering back on, after applying the changes

Upvotes: 2

Related Questions