Question

I have a CellTable that needs a subrow of a different type; similar to http://showcase2.jlabanca-testing.appspot.com/#!CwCustomDataGrid

I do not want to use DataGrid as I understand it to have a fixed height, and my table looks better with a dynamic height.

I've tried to extend CellTable then write

    public void renderRowValues(SafeHtmlBuilder sb,
            java.util.List<ShipmentLeg> values,
            int start,
            SelectionModel<? super ShipmentLeg> selectionModel){
        super.renderRowValues(sb, values, start, selectionModel);

        GWT.log("HELLO");
    }

What is a good strategy to accomplish this? Note: in this code GWT.log is never called as in the super a deprecation error is thrown

Cheers

Was it helpful?

Solution

The API between CellTable and DataGrid is the same. As of GWT 2.5 the renderRowValues() method is deprecated hence, in order to alter the default table structure of both tables (say, creating subrows), you need to provide a CellTableBuilder.

Both table implementations use a DefaultCellTableBuilder (an extension of AbstractCellTableBuilder that leverage most of the bits and expose only a buildRowImpl() method). This is what you are looking for, no matter if you are using CellTable or DataGrid.

Extend AbstractCellTableBuilder and give an implementation of buildRowImpl(), much like the sample you linked, does. Do note that you linked an old sample. You should always refer to the one in the current showcase, as the API is slightly different.

Side note: DataGrid does not have a 'fixed height' at all, but requires a ProvidesResize container, as it need to dynamically adjust its size when the layout change (e.g., on browser resize). Check this out, if you haven't already.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top