Dynatree在面对超过2000项时返回错误

Dynatree returns error when faced with more than 2000 items

本文关键字:返回 错误 2000项 面对 Dynatree      更新时间:2023-09-26

我使用dynatree,一切工作正常,但如果一个节点有大量的项目,我得到一个错误。我读过设置enableUpdate(false);函数,但它也没有帮助。什么好主意吗?

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;
    }
});

As per docs

tree.enableUpdate(使)

打开或关闭渲染并返回以前的模式。当添加大量节点时,禁用更新可能会加快处理速度。不要忘记在应用

更改后重新打开渲染。