在GWT面板中插入DIV

时间:2012-05-06 14:30:54

标签: gwt

我在我的应用程序jsp页面上有这个DIV,我需要“注入”到GWT VerticalPanel。编码在包含“__gwt_historyFrame”的iframe标记之上:

的index.jsp

<div class="footer" id="footer" style="display:none">
        <p>Copyright © 2012 MyCompany. All Rights Reserved.</p> 
        <a href="#">FAQ</a>
        <a href="#">Privacy</a>
        <a href="#">API</a>
        <a href="#">Contact Us</a>
</div>

我使用以下代码将DIV插入视图:

DivElement footer = (DivElement) document.getElementById("footer");
verticalPanel.getElement().appendChild(footer);

但是,虽然getElementById未返回null

,但它并未显示

这样做的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

有两件事:

  • 您必须删除display: none的{​​{1}}:footer
  • footer.getStyle().clearDisplay()是一个HTML表格,向VerticalPanel添加div可能无效。

如果我是你,我宁愿使用tableHTML.wrap(footer)并将该小部件添加到HTMLPanel.wrap(footer),作为小工具。

相关问题