本文介绍了动态加载100多个节点时Dynatree变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何加快速度?

我从JSON Web服务获得结果(快如闪电).使用

I get the results from JSON web service (lightning fast). Adding nodes to the tree using

类似

parentNode.addChild({
        key: key,
        title: value,
        addClass: cssClass
    });

不幸的是,包含100多个元素的树需要1.5分钟才能加载.我很失望...难道不是要与那么多节点一起使用吗?除了切换到其他组件,我现在还能做些什么?

Unfortunately, a tree with 100+ elements takes 1.5 minutes to load.I am disappointed...is it not made to be used with that many nodes? Anything I can do at this point aside from switching to another component?

谢谢!

推荐答案

此基准测试表明加载速度非常快: http://wwwendt.de/tech/dynatree/doc/test-bench. html (尽管总有改进的余地...)

This benchmark shows that it is loads pretty fast:http://wwwendt.de/tech/dynatree/doc/test-bench.html(Theres always room for improvement though...)

您的问题可能是,您分别加载并添加了节点吗?在这种情况下,树也被渲染 100次以上,并且 确实很慢.

Your problem might be, that you load and add the nodes seperately?In this case the tree is also rendered 100+ times, and that is slow indeed.

看看示例,看看如何通过一次调用来加载一批节点: http://wwwendt.de/tech/dynatree/doc/sample-lazy. html

Have a look at the sample, to see how load a batch of nodes with one call:http://wwwendt.de/tech/dynatree/doc/sample-lazy.html

这篇关于动态加载100多个节点时Dynatree变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 23:05