我使用 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;
}
});
最佳答案
根据 docs
tree.enableUpdate(启用)
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
关于javascript - 面对超过 2000 个项目时,Dynatree 返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8434095/