I am using GWT MVP and I would like to handle events in columns of DataGrid from Presenter. From GWT DataGrid ShowCase ...
// First name.
Column<ContactInfo, String> firstNameColumn =
new Column<ContactInfo, String>(new EditTextCell()) {
@Override
public String getValue(ContactInfo object) {
return object.getFirstName();
}
};
firstNameColumn.setSortable(true);
sortHandler.setComparator(firstNameColumn, new Comparator<ContactInfo>() {
@Override
public int compare(ContactInfo o1, ContactInfo o2) {
return o1.getFirstName().compareTo(o2.getFirstName());
}
});
dataGrid.addColumn(firstNameColumn, constants.cwDataGridColumnFirstName());
firstNameColumn.setFieldUpdater(new FieldUpdater<ContactInfo, String>() {
@Override
public void update(int index, ContactInfo object, String value) {
// Here I would like to call RPC methods
}
});
dataGrid.setColumnWidth(firstNameColumn, 20, Unit.PCT);
Above example , this code is writing in View side and it just really example. As mvp pattern , I just need to call rpc request to update database. This can't be done in View side but I have no idea how to set FieldUpdater from my presenter. Please help me how can I figure it out ? Thanks greatly .