Question

I'm creating a table using GWT, and in certain cells of the table, I want to store a piece of data in that cell's Widget for use in the Widget's handler callback. I can't seem to find an API method such as widget.setData(key, value);. How do I (or can I) accomplish this?

Was it helpful?

Solution

You could subclass the widget you want - and add the appropriate members and get/set methods.

The table example may be better served by storing the object inside a button instance, i.e an 'Edit' button.

Alternatively, you could maintain a map of objects that relate to each row index. This would save creating a lot of unnecessary widgets.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top