ADF: Undo Current Row Changes in table.

ADF: Undo Current Row Changes in table.

Today, I am going to share a very interesting tutorial. Sometimes user need to undo all changes performed in only selected table row and display the older values which exists in database.

So how to perform this task. If you are using “RollBack” operation, it reverts all changes performed in table. But if you want to keep all changes but undo the changes of  a single selected row. Then here is the solution. You have to get instance of current row and call “refresh” method.

1

 

 

2

 

  • Write following lines of code in ActionListener method of “Undo Change”.
    1. public void undoChanges(ActionEvent actionEvent) {  
    2.        BindingContext bc=BindingContext.getCurrent();  
    3.        BindingContainer binding=bc.getCurrentBindingsEntry();  
    4.         DCBindingContainer bindingsImpl = (DCBindingContainer) binding;  
    5.         DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(“EmployeesView1Iterator”);  
    6.         ViewObject vo=dciter.getViewObject();  
    7.         Row row=vo.getCurrentRow();  
    8.         if(row!=null)  
    9.         {  
    10.             row.refresh(Row.REFRESH_UNDO_CHANGES|Row.REFRESH_WITH_DB_FORGET_CHANGES);  
    11.               
    12.             }  
    13.         vo.executeQuery();  
    14.                              
    15.     }  
    1. public void undoChanges(ActionEvent actionEvent) {  
    2.        BindingContext bc=BindingContext.getCurrent();  
    3.        BindingContainer binding=bc.getCurrentBindingsEntry();  
    4.         DCBindingContainer bindingsImpl = (DCBindingContainer) binding;  
    5.         DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(“EmployeesView1Iterator”);  
    6.         ViewObject vo=dciter.getViewObject();  
    7.         Row row=vo.getCurrentRow();  
    8.         if(row!=null)  
    9.         {  
    10.             row.refresh(Row.REFRESH_UNDO_CHANGES|Row.REFRESH_WITH_DB_FORGET_CHANGES);  
    11.               
    12.             }  
    13.         vo.executeQuery();  
    14.                              
    15.     }  
  • 3

    About Manish Pandey

    Manish is a Project Leader at Jagran Prakashan Ltd, focused on Jdeveloper Fusion Web Application(specifically Oracle ADF). He shares his knowledge through the OTN Jdev/ADF Forum. He has written more than 50 article about Oracle ADF and Jdeveloper.

    Leave a Reply