# Container scroll bar jumps when I page through the values of the last grid

digulla
502 4

I have a borderlayout with a big center component that has autoscroll=true. The main components in the center are grids which use paging.

This works for all grids but the last one: When I page through grid1 and grid2, the scrollbar doesn't jump.

When I try to page in the bottom grid, the scrollbar will jump up, so the last grid won't be completely visible anymore. How do I fix that?

Demo code:

<?page title="Demo for Paging Scroll Bag" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript><![CDATA[

List data = new ArrayList();
for( int i=1; i<101; i++ ) {
data.add( "Row " + i );
}

]]></zscript>
<window title="Demo for Paging Scroll Bag" border="normal" width="400px" height="450px">
<borderlayout>
<center autoscroll="true">
<vbox width="100%">
<grid id="grid1" mold="paging" pageSize="10">
<columns>
<column>Data</column>
</columns>
</grid>

<grid id="grid2" mold="paging" pageSize="10">
<columns>
<column>Data</column>
</columns>
</grid>

<grid id="grid3" mold="paging" pageSize="10">
<columns>
<column>Data</column>
</columns>
</grid>
</vbox>
</center>
</borderlayout>
<zscript><![CDATA[

grid1.setModel( new ListModelList( data ) );
grid2.setModel( new ListModelList( data ) );
grid3.setModel( new ListModelList( data ) );

]]></zscript>
</window>
</zk>

delete retag edit

## 4 Replies

digulla
502 4

Update: When I add a div below the last grid with a height of at least 300px, the effect stops (or gets much better).

My guess is that the grid changes size while the new page is built and the position of the scrollbar adjusts. A similar effect happens when I page through the second grid when it's scrolled out at the top.

jumperchen
3909 2 8
http://jumperchen.blogspo...

You may specify a precise height for the grid to avoid jumping scrollbar.

digulla
502 4

How do I know the "best" height to use?

jumperchen
3909 2 8
http://jumperchen.blogspo...

It depends on the content, but it is hard to guess.

[hide preview]