I have rendered a custom cell which combines an image and text.
It looks like this:
class ImageTextCell extends AbstractCell<String>
My question is how to add this cell into celltable/datagrid.
I have tired this.
Column<Message, String> iconColumn = new Column<Message, String>(new ImageTextCell())
{
@Override
public String getValue(Message versionStatus) {
return ? // I dont know what to type here. How to return the ImageTextCell object }
};
The role of the
Cellobject is to turn a value into a piece of HTML. The role of theColumnis to get that value from each row. For example, you have a bunch ofMessages, each one on its own row – the Column should take aMessageand figure out whatStringto pass to theCell.The output of
getValuewill be fed into the input ofrender. The output ofrendershould be the HTML you want to see in your app.Pseudo-codily, here’s what GWT does for you:
You just have to define Column.getValue and Cell.render so that this process makes the table you want.