GXT 附加/渲染
我有一个 GXT ContentPanel 实例 (cp)。我尝试将 Text 对象添加到内容面板,如下所示:
Text text = new Text("Main Content Window");
cp.add(text);
但是,即使我执行了 text.setVisible(true),文本也不可见。在我的调试器中,我看到内容面板 (cp) 确实将文本对象添加到了 cp.items 列表中。但是,文本对象具有“rendered = false”和“attached = false”。
感谢您的帮助!
I have a GXT ContentPanel instance (cp). I attempt to add a Text object to the content panel as below:
Text text = new Text("Main Content Window");
cp.add(text);
However, the Text is not visible even though I did text.setVisible(true). In my debugger, I saw that the content panel (cp) does have the text object added to the cp.items list. However, the text object has "rendered = false" and "attached = false".
Thanks for Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Label 将文本添加到 ContentPanel,这很简单。
顺便说一句,文本不是添加到面板的组件(内容面板/布局容器)
我们只能将组件添加到容器中。
you may add the text to ContentPanel using Label which is straight forward.
by the way text is not not component to add to the panel(Contentpanel/ layout container)
we can add only component to the container.
如果 ContentPanel 已经呈现并且您向其中添加了任何内容,则必须调用 cp.layout() 来向 DOM 添加新内容。如果在渲染之前添加文本,则没有必要。
If ContentPanel is already rendered and you add anything to it you have to call cp.layout() to add new contents to the DOM. If you add the text before rendering it it's not necessary.