I wouldn't recommend this approach as the drawbacks cleary outweigh the benefits.
Here is the simplest approach I can think of and it only works with one type of column (Text column):
You have to send your data, that you want to display in a generic dynamic CellTable
, as a List
of Map
objects.
When you receiver the data on the client you have to dynamically construct the columns in the CellTable
. You can do this by looking at the keys of the first Map
object in your List.
You probably will have to implement a custom Column
to which you pass the key
of the corresponding field in your Map
object. In the getValue()
method of your custom Column
you will return the corresponding field of your Map
objects using the key
you passed in.
You can then use a TextCell to render the method.
Of course if you want to support different kind of types (Number, Date, etc) it get's more complicated.