How to determine CellTable row height?

223 views
Skip to first unread message

Mike Dee

unread,
May 8, 2012, 7:10:21 PM5/8/12
to google-we...@googlegroups.com
Is there a way to determine the height of a CellTable row?  The question has been asked several times here, but without an answer.  I would like to fit as many rows a CellTable as possible without scrolling.  So, if the browse'sr window, which contains a CellTable, can fit 10 rows, then I'd like to adjust the page size on my Pager to 10.  If the CellTable can accommodate 15 rows, then I'd like to display that many.

The one unknown piece of info is the height of a row. I have a working pager.  I have an AsyncDataProvider.  I just don't know how to figure out the height of a row.

Any ideas?

Mike

Andrei

unread,
May 9, 2012, 10:13:33 AM5/9/12
to Google Web Toolkit
If your data never wraps within a cell, then the height of the row is
always the same - it is determined by the CSS. (As a sidenote, you can
change it in your CSS, or even apply different heights to different
tables).

Else,

1. The height changes as data wraps within a cell. Thus, you can't
know the actual height of the row until the table is rendered.

2. If the height changes with data (some rows have longer data and
wrap, other rows don't), what's the point of changing the number of
rows? Your first 10 rows may take 240 pixels, the next 10 rows can
take 330 pixels, and so on.

Also, remember that data can wrap more often when columns are
narrower. This means that if you want to predict the height of your 10
rows, you also need to take into consideration the width of each
column.

3. Users can change the size of the font in their browsers, unless you
disable it, which is not a good practice. They can also resize their
windows, add or hide toolbars in their browsers, etc. You just can't
avoid having a scroll-bar.

Mike Dee

unread,
May 9, 2012, 7:51:46 PM5/9/12
to google-we...@googlegroups.com
Andrei,

That's a good response.  I think you convinced me to not do it.

Instead, I wonder if it is possible to do something like what other web apps do (Twitter and even the new GWT google group), which is to keep adding rows as one scrolls down.  I've experimented with range change event handler.  Maybe that would be a more modern way to provide tabular data?

Mike
Reply all
Reply to author
Forward
0 new messages