I had the same request and went for the easy quick and dirty trick, ie 
override the onresize method.

@Override public void onResize() { super.onResize(); if(dataProvider.getList
().isEmpty() || !dataGrid.isVisible() || (dataGrid.getVisibleItems().size() 
== 0)) { return; } try { int pageStart = pager.getPageStart(); int rowHeight 
= dataGrid.getRowElement(0).getOffsetHeight(); // TODO - find a way to 
calculate the visible part of the rows panel int height = dataGrid.
getOffsetHeight() - 30; //((HeaderPanel) 
(dataGrid.asWidget())).getHeaderWidget().getOffsetHeight(); pager.
setPageSize(Math.max(1, (int) Math.floor((double) height / rowHeight))); 
pager.setPageStart(pageStart); } catch(Exception e) { } } 

As you can see in the code, I have not found a reliable way to get the 
header's size, and fixed it to 30px, there is always a little too much at 
the bottom because of that + the fact that you need an integer number of 
lines (so you will never have it fitting perfectly anyway), but at least it 
gets adjusted to the right number of lines automatically.

On Tuesday, 19 August 2014 18:48:25 UTC+2, Magnus wrote:
>
> I know that someone posted a method here some years ago, but I cannot find 
> it anymore...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to