2

I'm developing an application using GWT. I'm using celltable to display dynamic values from database (based on a query). I have following queries:

Assume: I have set the table height as 100px. I have placed the table in a scrollpanel.

  1. Now, My query returns 20rows, which are more than 100px, I want the table to resize to fit all the 20rows. which inturn would cause the scrollpanel to resize, which inturn should resize the parent of the scrollpanel. First of all, I would like to know if this is possible at all? If so, how?

I have tried these: I thought, by obtaining the tables new and old height, I could resize by calling setHeight() and for the parent's height, by getParent().setHeight(). However, I was stupid to think this way as I'm setting the value of the height for the table to be 100px. As this is static, it would print the same value for old and new height and would change nothing.

Any ideas of how to proceed with this??

P.S: I'm using GWT2.3

Ashok
  • 1,902
  • 3
  • 22
  • 30
  • Why are you setting the height of the cellTable to 100px at the beginning? – Ioan Agopian Aug 16 '11 at 00:06
  • If we don't set a value for the height, would it not be null? – Ashok Aug 16 '11 at 00:15
  • 2
    No, it will resize depending on the number of rows, and available space. – Ioan Agopian Aug 16 '11 at 00:22
  • Thanks for that..It will resize. However only the cellTable resizes based on no.of rows ie. if during a search it returns 20rows, and i search again which returns only 2rows, the rows resizes.. But not the table. I want the widget holding the table to expand/shrink(resize) based on row count. For instance, if a table has 20rows, I want the window height to be increased and if the table has 2rows, it should be shrinked to appropriate height. Any ideas for this?? – Ashok Aug 16 '11 at 00:38

1 Answers1

4

You're sure that you're not setting a fixed size for the celltable containers?

The containers will shrink, expand with the celltable, but they also need to not have their height set (the height defaults to auto - which is the behavior that you need).

Ioan Agopian
  • 788
  • 5
  • 9
  • Perfect! I got where I went wrong. I was using a Layoutpanel which had to have initial height. So, that forbids the celltable to increase its height. I've replaced the layoutpanel with an absolutepanel and things are working as expected. Thanks alot Jonic! – Ashok Aug 16 '11 at 02:59