Kendo Treeview扩大了大树问题 [英] Kendo Treeview Expanding big tree issue

查看:125
本文介绍了Kendo Treeview扩大了大树问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用kendo创建了树控件TreeView.it有超过10,000个节点,我在创建Tree时使用了loadOnDemand false。
我提供了一个按照级别扩展树的功能,为此我创建了一个方法,它将参数level作为数字并相应地展开,用户可以在方法中输入15(最大级别),它适用于所有级别的500到600个节点,但是当树有超过5000个节点时,如果用户尝试扩展到第二级节点之上,则浏览器挂起并显示没有响应错误。

I have created a tree control using kendo TreeView.it has more than 10,000 nodes and i have used loadOnDemand false when creating Tree. I am providing a feature to expand the tree by its level, for this i have created a method which takes the parameter "level" as number and expand it accordingly and user can enter 15 (max level) into the method, it works fine with 500 to 600 nodes for all the levels but when tree has more than 5000 nodes than if user is trying to expand above the 2nd level nodes then browser hangs and shows not responding error.

我为扩展树而创建的方法是: -

Method which i have created to expand the tree is :-

function ExapandByLevel(level, currentLevel) {
  if (!currentLevel) { 
    currentLevel = 0;
  }
  if (level != currentLevel) {
    var collapsedItems = $("#treeView").find(".k-plus:visible"); 
    if (collapsedItems.length > 0) {
        setTimeout(function () {
            currentLevel++;

            var $tree = $("#treeView");
            var treeView = $tree.data("kendoTreeView");

            var collapsedItemsLength = collapsedItems.length;
            for (var i = 0; i < collapsedItemsLength; i++) {
                treeView.expand($(collapsedItems[i]).closest(".k-item"));
            }
            ExapandByLevel(level, currentLevel);
        }, 100);
    }
    else {
        //console.timeEnd("ExapandByLevel");
        hideLoading();
    }
  }
  if (level == currentLevel) {

    hideLoading();
  }
}

调用上面给出的方法如下: -

call above given method like this:-

ExapandByLevel(15);

此处15是要在树中展开的等级。

here 15 is level to expand in tree.

当树的节点数超过5000个时,如果用户尝试在第二级节点上方展开,则浏览器会挂起并显示没有响应错误。
请建议任何方式做到这一点,我想要的是扩展可以包含超过5000个节点的树。

when tree has more than 5000 nodes than if user is trying to expand above the 2nd level nodes then browser hangs and shows not responding error. please suggest any way to do this,what i want is expand the tree which can contains more than 5000 nodes.

推荐答案

您的问题的解决方案非常简单:更新您正在使用的Kendo UI版本,因为他们已优化(loooooooooot) HierarchicalDataSource 和<$的代码c $ c> TreeView 。

The solution to your problem is pretty simple: Update the version of Kendo UI that you are using since they have optimized (a loooooooooot) the code for HierarchicalDataSource and for TreeView.

检查: http://jsfiddle.net/OnaBai/GHdwR/135/

这是我改变了版本的kendoui.all.min.js到v2014.1.318。我甚至没有改变CSS(尽管你应该)。您将看到打开这5000个节点非常快。

This is your code where I've change the version of kendoui.all.min.js to v2014.1.318. I didn't even changed the CSS (despite you should). You will see that opening those 5000 nodes is pretty fast.

然而,如果你去10000个元素,你很可能会认为它很慢,但很抱歉挑战你:你呢真的以为10000节点树是用户友好的吗?树是提供如此大量数据的正确方法吗?

Nevertheless, if you go to 10000 elements you will very likely consider it slow but sorry for challenging you: do you really think that 10000 nodes tree is User Friendly? Is a Tree the correct way of presenting such a huge amount of data?

这篇关于Kendo Treeview扩大了大树问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆