Search code examples
javagwtcelltablegwt-celltable

GWT CellTable resize height within Layout


I'm trying to dynamiclly resize a CellTable within my whole layout and I'm not sure if its even possible.

My main layout (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>

The part which should be resizeable is within my mainContentPanel1and is a ScrollPanel. That means that within my SplitPanel I have a ScollPanel with my CellTable. I'm trying to accomplish that when I change the height from my SplitPanel that my CellTable grows or gets smaller.

my 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>

I basically tried to do this with setting all heights to "100%" it does not work. Do I have to what for an specific onResize or some other handler? not sure whats the correct approach for that is. thanks for any, I can give more code or specific information if needed :)


Solution

  • I fixed this problem like in the comment from @Ümit recommended by using a ResizeLayoutPanel.