gwtcelltable

How to read revised data from a TextInputCell in a CellTable in GWT?


Each row in the CellTable is a TextInputCell. And I use a ListDataProvider to populate the table at the beginning. However, after I did some changes on the data in the TextInputCell. I tried to read the revised data using the data provider. However, the data in the data provider remains unchanged.

What's the problem here? And how to read the revised data out of the CellTable?


Solution

  • You need to add a FieldUpdater to your cell:

    myColumn.setFieldUpdater(new FieldUpdater<MyObject, String>() {
        @Override
        public void update(int index, MyObject myObject, String value) {
            myObject.setSomeValue(value);
        }
    });
    

    The same approach applies to all types of cells.