如何阻止extjs treepanel无限加载? [英] How to stop extjs treepanel from loading infinitely?

查看:118
本文介绍了如何阻止extjs treepanel无限加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后,在与extjs树面板,树存储和构建自定义读取器纠缠在一起以读取和转换pentaho数据长达2周之后,我设法将pentaho数据加载到extjs的treepanel中.

Finally after struggling with extjs tree panel, tree store and building custom reader to read and convert pentaho data for 2 weeks I have managed to load pentaho data into treepanel of extjs.

现在,我的树"面板正在无限加载相同的数据. Treepanel如下所示:

Now my Tree panel is loading same data infinitely. Treepanel looks as follows :

部分json数据如下:

Part of my json data looks as follows :

{
    {name: 'US', candidateCount: 3, children: []},
    {name: 'India', candidateCount: 922, children: [
       {name: 'Goa', candidateCount:124, children: []},
       {name: 'Maharashtra', candidateCount: 43, children: [
             {name: 'Pune', candidateCount: 3},
             {name: 'Mumbai', candidateCount: 33},
             {name: 'Kolhapur', candidateCount: 4},
             {name: 'XXX', candidateCount: 3},
        ]}
     ]},
    {name: 'UK', candidateCount: 1, children: []},
}

如上图所示,展开India节点后,它再次加载了国家/地区级别的数据(即国家/地区名称为US,uk,印度,UK).实际上,我想显示状态数据,例如马哈拉施特拉邦,果阿的数据.代替了那个treepanel再次再次加载相同的数据.

As you can see in image above, after expanding India node it has again loaded data of country level (i.e. country names US, uk, India, UK). Actually I want to show state level data like data of Maharashtra, Goa. Instead of that treepanel is again loading same data again.

如何避免这种行为?我已经将美国,英国和印度节点的leaf属性设置为false.

How to avoid this kind of behavior? I have already set leaf property of US, uk and India nodes to false.

我尝试将Expanded属性设置为true,但是随后treepanel一次又一次地加载相同的节点,并且我的浏览器选项卡刚刚被挂起.

I tried setting Expanded property to true but then treepanel keeps loading same nodes again and again and my browser tab just gets hanged.

请让我知道如何避免这种情况?我希望树面板仅加载一次数据.

Please let me know how to avoid this? I want tree panel to load data only once.

编辑-解决此问题的方法

EDIT - Solution to this problem

推荐答案

将数据项设置为:

{
    ...
    leaf: true
}

将阻止它.

这篇关于如何阻止extjs treepanel无限加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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