Dynatree returns error when faced with more than 2000 items
-
11-03-2021 - |
Question
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;
}
});
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow