javaswingjtablevaadintablemodel

How to fire ValueChangeEvent for table?


There are two listeners:

table.addListener(new ItemClickListener() {
    public void itemClick(ItemClickEvent event) {
        // fireEvent(...);
    }
});

table.addListener(new Table.ValueChangeListener() {
    public void valueChange(final ValueChangeEvent event) {
        // do something
    }
});

I want to fire an event from the first listener to call the second.

In one listener, I want to update the data source for the table by clicking on the row; in the second listener, I want to restore the cursor on the selected row.

How can I do it?


Solution

  • If you change a column value of a row, then second listener is fired. To do so, you can change the column then you can regain its value in the second listener.