带有rootVisible = Treepanel = true未显示 [英] Treepanel with rootVisible = true not shown
本文介绍了带有rootVisible = Treepanel = true未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 rootVisible:false
时,我的树显示正确。但是将它设置为 true
导致没有树显示,没有错误。
My tree is shown correctly when using rootVisible: false
. However setting it to true
leads to no tree display and no error.
我的目的是显示根节点我可以定义为 /
或根
。如何实现?
My aim is to show a root node that I can define as /
or Root
. How to achieve this?
我的解决方案:
rootVisible
to true
并将其添加到我的树存储区中:
Putting rootVisible
to true
and adding this to my tree store:
root: {
id : '/',
expanded : false,
name : '/',
type : 'folder',
path : '/',
root : true
}
推荐答案
默认情况下,Rootnode的名称为 Root
。但是您可以指定任何其他名称。
The name for the Rootnode is Root
by default. But you can specify any other name.
var store = Ext.create('Ext.data.TreeStore', {
root: {
text: "/",
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: true,
renderTo: Ext.getBody()
});
如果没有帮助,请从服务器发送的数据发布更多代码,TreeStore,reader 。
If this don't help please post more code from your data send by the server, TreeStore, reader.
这篇关于带有rootVisible = Treepanel = true未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文