3

I am familar with getOffsetHeight and getElement.getClientHeight. The problem is I can't find when to call these methods to get the rendered height of my CellTable. I've tried adding an attach handler, row change handler, and overriding setRowData. I'm basically shooting around in the dark and wondering if any GWT experts can help me find out when to call those methods to get the correct height.

I'm trying to put the CellTable in a G-mail contextual gadget then change the height of the gadget using the dynamic height feature, FYI.

John Wheeler
  • 797
  • 1
  • 7
  • 21

2 Answers2

3

I had a similar issue with a CellList. I managed to solve it listening for load state changes. Basically this code is called every time the list/table is updated:

taskList.addLoadingStateChangeHandler(new LoadingStateChangeEvent.Handler() {           
            @Override
            public void onLoadingStateChanged(LoadingStateChangeEvent event) {
                if(event.getLoadingState() == LoadingState.LOADED) {
                      //Calculate height here
                }
            }
        }); 

Hope this helps.

Javier Ferrero
  • 8,741
  • 8
  • 45
  • 50
2

You can try to use the scheduleDeferred:

Scheduler.get().scheduleDeferred(new ScheduledCommand() {
    public void execute() {
        //calculate height
    }
});
Ümit
  • 17,379
  • 7
  • 55
  • 74