最后,在 extjs 树面板、树存储和构建自定义阅读器以读取和转换 pentaho 数据 2 周后,我设法将 pentaho 数据加载到 extjs 的树面板中。
现在我的树面板无限加载相同的数据。Treepanel 如下所示:
我的部分 json 数据如下所示:
{
{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
节点后,它再次加载了国家级别的数据(即国家名称美国、英国、印度、英国)。实际上,我想显示州级数据,例如果阿马哈拉施特拉邦的数据。而不是该树形面板再次加载相同的数据。
如何避免这种行为?我已经将leaf
美国、英国和印度节点的属性设置为false
.
我尝试将Expanded
属性设置为,true
但随后 treepanel 不断加载相同的节点,并且我的浏览器选项卡被挂起。
请告诉我如何避免这种情况?我希望树面板只加载一次数据。
编辑 - 这个问题的解决方案