2

我使用 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;
    }
});
4

1 回答 1

2

根据文档

tree.enableUpdate(启用)

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

于 2011-12-08T21:20:56.757 回答