Home > Web Front-end > JS Tutorial > JQery jstree large data volume problem solution_jquery

JQery jstree large data volume problem solution_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:32:48
Original
1404 people have browsed it

Problem solution: The generated tree is loaded step by step, and there is a code for generating nodes in the open function:
Code

Copy code The code is as follows:

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
Copy the code The code is as follows:

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);
Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template