Problem solution: The generated tree is loaded step by step, and there is a code for generating nodes in the open function:
Code
for (var i=0; i{
var n = TREE_OBJ.create(data[i], $ (NODE));
if (onaddnode) onaddnode(n);
}
var firstChild = TREE_OBJ.children(NODE)[0];
if ($(firstChild).attr(' id')==-1)
TREE_OBJ.remove(firstChild);
The problem lies in the TREE_OBJ.create function, which consumes a lot of performance. Change the code to the following:
Code
var children= "";
for (var i=0; i{
children = TREE_OBJ.parseJSON(data[i]);
}
if (children != "")
$(NODE).children('ul').html(children);
var firstChild = TREE_OBJ.children(NODE)[0];
if ($(firstChild) .attr('id')==-1)
TREE_OBJ.remove(firstChild);
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn