GWT用RootPanel替换div(不附加!) [英] GWT Replace div (not append!) with RootPanel

查看:89
本文介绍了GWT用RootPanel替换div(不附加!)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在GWT中执行RootPanel.get("someDiv").add(myPanel);,我总是得到: <div id="someDiv"><div></div></div>

In GWT if I do RootPanel.get("someDiv").add(myPanel); I invariably get: <div id="someDiv"><div></div></div>

但是,我只想要1个层次结构,即<div id="someDiv"><div>,其中someDiv包含myPanel.

But, I just want 1 level of hierarchy, i.e., <div id="someDiv"><div> where the someDiv contains myPanel.

有什么想法吗? 谢谢!

Any ideas? Thanks!

推荐答案

面板必须是div(或表或跨度).您的RootPanel是一个div,您添加到其中的面板是一个div.

A Panel has to be a div (or table or span). Your RootPanel is a div, and the Panel you add to it is a div.

如果您要编写一个整页应用程序,则RootPanel.get()返回该元素,因此向其添加div将仅导致

If you're writing a full-page app, RootPanel.get() returns the element, so adding a div to that will only result in one div inside the

但是说实话,尝试摆脱应用程序中的div嵌套并不会节省您任何明显的时间.

But honestly, trying to get rid of one nesting of divs in your application is not going to save you any noticeable amount of time.

这篇关于GWT用RootPanel替换div(不附加!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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