AM01
AM01

Reputation: 314

GWT Celltable column with label and image

I am looking to add a label and image to a CellTable column, with following requisites:
- Label should be followed by an image.
- Click on the column (anywhere on label or image), toggles the image.

I am thinking of creating a custom widget containing an HorizontalPanel. Which in itself contains the Label and Image. Before putting substantial time on the same, just want an confirmation whether this approach is proper ?

Upvotes: 0

Views: 1336

Answers (1)

Riley Lark
Riley Lark

Reputation: 20890

No, you cannot put a widget in a CellTable. You will have to make a custom cell (extend AbstractCell) and generate HTML directly.

Take a look at GWT's implementation of different cells to see how they achieve clicking, etc. There are no nice ClickEvents, for example - you have to respond to the browser events directly.

To toggle an image you will have to re-draw the entire table, or use crazy javascript that you don't want to use.

Upvotes: 2

Related Questions