Buttons in Table

Hello everybody,

i´ve got a table with a generatedcolumn were i add a button to every table item

table.addGeneratedColumn("", new Table.ColumnGenerator() {
            public Object generateCell(final Table source, final Object itemId, final Object columnId) {
                final Button btn = new Button();
                btn.addListener(new Button.ClickListener() {
                    public void buttonClick(ClickEvent event) {
                      //do something
                return btn;

if an event is fired, i want to change the icon of the button to which the event belongs.
how do i get access to the button to change the icon?

You could try the getButton() method in Button.ClickEvent.

but the button is not clicked :smiley:

it is another button that has been clicked.

Ah, OK. I’m not sure what you are trying to do from your example, but I don’t think there is a simple way. You could just store the created buttons in some data structure where you can access them easily, such as a HashMap using item and column IDs in the key. If you do so, you need to clean up the stored generated components when table is scrolled elsewhere, such as in a DetachListeners attached to the components.

my plan is to allow the user to mark some objects as favorite at two different positions in the applications.

and one position is the button in the table.

when you click the button in the table, the icon of the button and the icon at the other position should change.
and the same when the user clicks the button at the other position in the application

hope you get what i´m trying to create :smiley:

is there no way to get access to the button with the itemid of the tableitem?