Search code examples
gwtdataprovidercelltable

GWT CellTable Data Not Displaying


I have the following code in my modules onModuleLoad() method:

    List<MyPromo> promotionData = new ArrayList<MyPromo>();
    MyPromo promotion1 = new MyPromo(...);
    promotionData.add(promotion1);

    PromotionTable<MyPromo> promoTable = new PromotionTable<MyPromo>(tableColumns, promotionData);

and

public class PromotionTable <T extends Promotion> extends CellTable<T>{

    public PromotionTable(List<ColumnGroup<T>> columns, List<T> data) {
        super();
        this.setWidth("100%");
        this.setHeight("500px");

        this.setHeaderBuilder(new PromotionTableHeaderBuilder(columns, this));
        this.setFooterBuilder(new PromotionTableFooterBuilder(this));

        ListDataProvider<T> dataProvider = new ListDataProvider<T>();
        dataProvider.setList(data);
        dataProvider.addDataDisplay(this);
    }
    ...

The columns for the CellTable just take properties off the MyPromo object and return a String value to display. However, nothing is displayed in the table, just the column headers. Any idea why this is?


Solution

  • I was constructing the dataProvider and assigning it to the celltable (or mu extension of) in the constructor. It didn't like this for some reason, when I moved it out it worked.