Hello,
Sometimes I need to undo the row edit changes on a ListGrid. How can I do that?
I've tried several ideas but I had no luck:
Using SmartGWT 2.5 on IE 8
Thanks!
Sometimes I need to undo the row edit changes on a ListGrid. How can I do that?
I've tried several ideas but I had no luck:
Code:
grid.addEditCompleteHandler(new EditCompleteHandler() {
public void onEditComplete(EditCompleteEvent event) {
if( someCondition ) {
ListGridRecord newRecord = grid.getRecord( event.getRowNum() );
ListGridRecord oldRecord = event.getOldRecord();
// This method doesn't undo the changes
grid.discardAllEdits(
new int[]{event.getRowNum()}, false);
// This doesn't undo the changes either
newRecord.setAttribute( SOME_ATTRIBUTE,
oldRecord.getAttribute( SOME_ATTRIBUTE ));
// This method doesn't exist but could be useful
event.undoEdit();
}
}
}
Thanks!
Comment