【问题标题】:GWT CellTable resize height within LayoutGWT CellTable在布局内调整高度
【发布时间】:2014-09-23 12:30:53
【问题描述】:

我正在尝试在整个布局中动态调整 CellTable 的大小,但我不确定它是否可能。

我的主布局(uiBinder)

<g:north size="5" unit="EM">

    <g:SimplePanel ui:field="headerPanel" addStyleNames="{style.headerImage}" />

</g:north>


<g:north size="2" unit="EM">
    <g:SimplePanel ui:field="menuHeaderPanel" addStyleNames="{style.menuHeaderPanel}">
        <my:MenuViewImpl ui:field="mainMenu"/>
    </g:SimplePanel>        
</g:north>


<g:west size="10" unit="EM">
    <g:SimplePanel ui:field="menuWestPanel" addStyleNames="{style.menuWestPanel}">      
        <my:SubMenuViewImpl ui:field="subMenu"/>
    </g:SimplePanel>
</g:west>


<g:center size="50" unit="EM">      

    <g:SplitLayoutPanel ui:field="splitPanel">

        <g:center> 
             <g:SimplePanel ui:field="mainContentPanel1" addStyleNames="{style.mainContentPanel}" />                
        </g:center>

        <g:south size="30" unit="EM">
             <g:SimplePanel ui:field="mainContentPanel2" addStyleNames="{style.mainContentPanel1}"/>        
        </g:south>

    </g:SplitLayoutPanel>

</g:center>

应该可以调整大小的部分在我的mainContentPanel1 中,并且是一个滚动面板。这意味着在我的 SplitPanel 中,我的 CellTable 有一个 ScollPanel。当我从 SplitPanel 更改 CellTable 增长或变小的高度时,我正在尝试实现这一点。

我的 mainContentPanel1 (uiBinder):

<g:VerticalPanel width="100%" height="100%">

    <g:Label ui:field="header" width="50%">Users</g:Label>

    <g:ScrollPanel addStyleNames="{style.scrollpanel}" width="100%" height="100%">
        <c:CellTable ui:field='userCellTable' width="100%" height="100%"/>
    </g:ScrollPanel>

    <g:HorizontalPanel styleName="{style.horizontalButtonPanel}">
        <g:Button ui:field="createButton">New</g:Button>
        <g:Button ui:field="refreshButton">Refresh</g:Button>
        <g:Button ui:field="removeSelectedButton">Delete Selection</g:Button>
    </g:HorizontalPanel>

</g:VerticalPanel>

我基本上试图通过将所有高度设置为“100%”来做到这一点,但它不起作用。对于特定的 onResize 或其他处理程序,我必须做什么?不知道什么是正确的方法。感谢任何人,如果需要,我可以提供更多代码或具体信息:)

【问题讨论】:

  • 有什么理由不使用 DataGrid 而不是 CellTable 吗?此外,您可能必须在 `
    ` 和 ScrollPanel 之间有一个完整的 LayoutPanels 链,或者您应该将 ScrollPanel 包装在提供明确大小的 ResizeLayoutPanel 中。
  • 谢谢你试试ResizeLayoutPanel。使用DataGrid 而不是CellTable 有什么好处?

标签: java gwt celltable gwt-celltable


【解决方案1】:

我解决了这个问题,就像@Ümit 使用ResizeLayoutPanel 推荐的评论一样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-17
    相关资源
    最近更新 更多