2

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;
    }
});
oleksii
  • 35,458
  • 16
  • 93
  • 163
Alexandr
  • 5,460
  • 4
  • 40
  • 70

1 Answers1

2

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

oleksii
  • 35,458
  • 16
  • 93
  • 163
  • @Alexander: Than you should mark oleksii's answer as the right answer for your question, so he can gain the reputation score for it. – Juraj.Lorinc Apr 10 '12 at 09:46