0
votes

Gwt CellTable can show only objects. But I need to generate columns dynamically (so I can't predefine all fields in my class that require CellTable); and make some rows as "headers" Like this:

enter image description here

Or may be you can advice me some other solution. (Table can have up to 2000 rows. So also I need paging)

2
Can you clarify a bit, is your data object fixed or it is dynamically retrieved at runtime? Which is the driving point (UI or Data) in your case? - questzen
@questzen, Columns and their data dynamically retrieved at runtime. Data - MyTitle

2 Answers

1
votes

The Celltable requires you to define each row separately anyway. If you look at the Showcae code, you see, that each Column is added like this:

Column<YOURDATAOBJECT, String> nameColumn = new Column<YOURDATAOBJECT, String>(
        new TextCell()) {
    @Override
    public String getValue(YOURDATAOBJECT object) {
        return object.getYOURCOLUMDATA();
    }
};
this.addColumn(nameColumn, YOURHEADERNAME);

So it is possible to add the columns as simply as that as at any point of your code, as long as the data is in your DataProvider you defined for you CellTable. So you question doesn't concern the CellTable, it concerns the DataProvider you defined for you CellTable.

CellTable supports paging via the SimplePager.

All in all CellTable supports both features you need, but it takes some time to understand them.

In case You haven't seen it, take a look at the official Google ShowCase for CellTable

0
votes

Currently as far as I know the gwt celltable can't do the header rows like you want. I believe the GXT grid controls can though.

http://www.sencha.com/examples/