Hi.
I am trying to utilize the Grid.EditorListener but it seems to be not working in my case. This may be a very simple mistake so please excuse me if it is.
The Grid is required to not have buffered editing (i.e. Save Cancel buttons should not show). Moreover, the database should also be updated immediately right after an Item is edited. I am using a LazyQueryContainer which handles the db update via its’ saveItems() function. This is triggered via container.commit();
Here is a snippet from my code:
gridQSRHeader.setImmediate(true);
gridQSRHeader.setEditorBuffered(false); // disable Save Cancel button on Grid Editor
Grid.EditorListener editorListener = new Grid.EditorListener() {
private static final long serialVersionUID = 1L;
@Override
public void editorOpened(EditorOpenEvent e) {
System.out.println("Editor Opened");
}
@Override
public void editorMoved(EditorMoveEvent e) {
System.out.println("Editor Moved");
if(lqHeaderContainer.isModified()){
lqHeaderContainer.commit();
}
}
@Override
public void editorClosed(EditorCloseEvent e) {
System.out.println("Editor Closed");
if(lqHeaderContainer.isModified()){
lqHeaderContainer.commit();
}
}
};
gridQSRHeader.addListener(Grid.EditorOpenEvent.class, editorListener, Grid.EditorListener.EDITOR_OPEN_METHOD);
gridQSRHeader.addListener(Grid.EditorMoveEvent.class, editorListener, Grid.EditorListener.EDITOR_MOVE_METHOD);
gridQSRHeader.addListener(Grid.EditorCloseEvent.class, editorListener, Grid.EditorListener.EDITOR_CLOSE_METHOD);
When I run the above code the container.commit() does not happen. Even the Console has no output text.
Any help would be appreciated. Thanks!