Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the height of a GWT CellTable after it's done rendering?

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.

like image 580
John Wheeler Avatar asked Jul 15 '26 01:07

John Wheeler


2 Answers

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.

like image 91
Javier Ferrero Avatar answered Jul 16 '26 16:07

Javier Ferrero


You can try to use the scheduleDeferred:

Scheduler.get().scheduleDeferred(new ScheduledCommand() {
    public void execute() {
        //calculate height
    }
});
like image 40
Ümit Avatar answered Jul 16 '26 14:07

Ümit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!