PDA

View Full Version : Change fields of a record in EditorGrid on ValidateEdit



MickeyMiner
27 Apr 2010, 7:28 AM
Hi,

Before I leave and submit a record in EditorGrid I would like perform some operations on it. However when the Events.ValidateEdit is fired, I can not access the new values of my Company object, but only the old ones. How do I access them?

The line System.out.println("Events.ValidateEdit: " + e.getNameNew()); always writes the value that was in the field before editing it.


Listener<GridEvent<Company>> gridValidateEditListener = new Listener<GridEvent<Company>>() {
@Override
public void handleEvent(GridEvent<Company> be) {
if (be.getType() == Events.ValidateEdit) {
Company c = (Company) be.getModel();
System.out.println("Events.ValidateEdit: " + c.getNameNew());
if (c.getNameNew() == null) {
c.setMarkForDeletion(true);
c.setNameNew(e.getNameOld());
}
}
}
};Is there any Tutorial on how EditorGrid/View/Store/Record/Model cooperate? When are what events fired? What is the proper way of using these objects?

Thank you for your help.

mm

sven
27 Apr 2010, 7:31 AM
gridEvent.getValue() gets you the new one. This is also documented at the place where you found the event.